search: set the mark at the end of a found match so it gets highlighted

Not only does the match get highlighted (for better visibility), but
this also allows deleting the match with a single keystroke (^K, or
<Del> or <Bsp> when --zap is used) and then type something else.

This https://savannah.gnu.org/bugs/?59655.
Requested-by: Noam Sondak <noamso@gmail.com>
master
Benno Schulenberg 2020-12-12 14:48:59 +01:00
parent e353203010
commit 856a6ecde3
1 changed files with 9 additions and 0 deletions

View File

@ -322,6 +322,15 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
if (match_len != NULL)
*match_len = found_len;
#ifndef NANO_TINY
if (modus == JUSTFIND && (!openfile->mark || openfile->softmark)) {
openfile->mark = line;
openfile->mark_x = found_x + found_len;
openfile->softmark = TRUE;
shift_held = TRUE;
}
#endif
/* Wipe the "Searching..." message and unsuppress cursor-position display. */
if (feedback > 0) {
wipe_statusbar();