From: Christian Weisgerber Subject: Re: tog: clear search highlighting when reloading view To: gameoftrees@openbsd.org Date: Thu, 23 Dec 2021 21:07:48 +0100 Stefan Sperling: > > @@ -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); > > There is a case which you missed for the diff view: Changing the amount > of diff context with '[' or ']' has the same problem. As do 'a' and 'w', presumably. > Instead of having at least three places which reset those 3 variables, > maybe create a function that resets diff view state and call it from > at least those three places? Well, ']' doesn't reset the other two variables and '[' only does so conditionally. All affected commands call diff_view_indicate_progress() and create_diff(), but semantically, "s->matched_line = 0" doesn't feel like it belongs to either. -- Christian "naddy" Weisgerber naddy@mips.inka.de