tog: clear search highlighting when reloading view Clear the search highlighting when replacing the content of a diff view ('<', '>', '[', ']', 'a', 'w') or a blame view ('b', 'p', 'B'). Previously the position would remain highlighted even if the text there had changed. ok stsp@ or a blame view
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
diff --git a/tog/tog.c b/tog/tog.c
index 689aa4b..4416f59 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -3699,6 +3699,7 @@ input_diff_view(struct tog_view **new_view, struct tog_view *view, int ch)
wclear(view->window);
s->first_displayed_line = 1;
s->last_displayed_line = view->nlines;
+ s->matched_line = 0;
diff_view_indicate_progress(view);
err = create_diff(s);
break;
@@ -3757,6 +3758,7 @@ input_diff_view(struct tog_view **new_view, struct tog_view *view, int ch)
case '[':
if (s->diff_context > 0) {
s->diff_context--;
+ s->matched_line = 0;
diff_view_indicate_progress(view);
err = create_diff(s);
if (s->first_displayed_line + view->nlines - 1 >
@@ -3769,6 +3771,7 @@ input_diff_view(struct tog_view **new_view, struct tog_view *view, int ch)
case ']':
if (s->diff_context < GOT_DIFF_MAX_CONTEXT) {
s->diff_context++;
+ s->matched_line = 0;
diff_view_indicate_progress(view);
err = create_diff(s);
}
@@ -3793,6 +3796,7 @@ input_diff_view(struct tog_view **new_view, struct tog_view *view, int ch)
s->first_displayed_line = 1;
s->last_displayed_line = view->nlines;
+ s->matched_line = 0;
diff_view_indicate_progress(view);
err = create_diff(s);
@@ -3817,6 +3821,7 @@ input_diff_view(struct tog_view **new_view, struct tog_view *view, int ch)
s->first_displayed_line = 1;
s->last_displayed_line = view->nlines;
+ s->matched_line = 0;
diff_view_indicate_progress(view);
err = create_diff(s);
@@ -4369,6 +4374,7 @@ run_blame(struct tog_view *view)
s->last_displayed_line = view->nlines;
s->selected_line = 1;
}
+ s->matched_line = 0;
done:
if (blob)