search: just highlight the found occurrence, instead of marking it

Requested-by: Peter Passchier <peter@passchier.net>
master
Benno Schulenberg 2021-01-25 16:35:07 +01:00
parent ade2fafbd3
commit 37717baeed
4 changed files with 12 additions and 7 deletions

View File

@ -461,7 +461,7 @@ void show_help(void)
didfind = 0;
#ifndef NANO_TINY
openfile->mark = NULL;
spotlighted = FALSE;
hide_cursor = FALSE;
if (bracketed_paste || kbinput == BRACKETED_PASTE_MARKER) {

View File

@ -2540,6 +2540,11 @@ int main(int argc, char **argv)
} else
edit_refresh();
#ifndef NANO_TINY
/* Let the next keystroke cancel the highlighting of a search match. */
refresh_needed = spotlighted;
spotlighted = FALSE;
#endif
errno = 0;
focusing = TRUE;

View File

@ -324,12 +324,12 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
#ifndef NANO_TINY
if (modus == JUSTFIND && ISSET(MARK_MATCH) && (!openfile->mark || openfile->softmark)) {
openfile->mark = line;
openfile->mark_x = found_x + found_len;
openfile->softmark = TRUE;
spotlighted = TRUE;
light_from_col = xplustabs();
light_to_col = wideness(line->data, found_x + found_len);
if (!ISSET(SHOW_CURSOR))
hide_cursor = TRUE;
shift_held = TRUE;
refresh_needed = TRUE;
}
#endif

View File

@ -2854,7 +2854,7 @@ int update_line(linestruct *line, size_t index)
wattroff(edit, hilite_attribute);
}
if (spotlighted && line == openfile->current && !inhelp)
if (spotlighted && line == openfile->current)
spotlight(light_from_col, light_to_col);
return 1;
@ -2915,7 +2915,7 @@ int update_softwrapped_line(linestruct *line)
from_col = to_col;
}
if (spotlighted && line == openfile->current && !inhelp)
if (spotlighted && line == openfile->current)
spotlight_softwrapped(light_from_col, light_to_col);
return (row - starting_row);