From: Christian Weisgerber Subject: tog: clear search highlighting when reloading view To: gameoftrees@openbsd.org Date: Mon, 20 Dec 2021 22:10:14 +0100 In tog, highlighting from a prior search persists when you switch the content of a diff view ('>', '<') or a blame view ('b', 'p', 'B'). To reproduce: * Start "tog log". * Hit enter for a diff view. * Search for something that appears in the first few lines. -> The match is highlighted. * Move to previous or next commit with '<' or '>'. -> The text position of the match from the previous step is still highlighted. The same happens in a blame view when you reload it with a selected/ parent/previous commit with 'b', 'p', 'B'. Those actions should reset the matched_line variable in the view state. For the diff view, input_diff_view() looks like the right place. I'm less certain about the blame view, but run_blame() works for me. OK? diff 46ea77db89a0945a013f032c6c6a94779126412f /home/naddy/got blob - 689aa4b67e0bcae980ac8b0f007f11c145528be1 file + tog/tog.c --- tog/tog.c +++ tog/tog.c @@ -3793,6 +3793,7 @@ input_diff_view(struct tog_view **new_view, struct tog 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 +3818,7 @@ input_diff_view(struct tog_view **new_view, struct tog 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 +4371,7 @@ run_blame(struct tog_view *view) s->last_displayed_line = view->nlines; s->selected_line = 1; } + s->matched_line = 0; done: if (blob) -- Christian "naddy" Weisgerber naddy@mips.inka.de