From 856a6ecde33726a00d02c1633b0da7af9665ebd3 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sat, 12 Dec 2020 14:48:59 +0100 Subject: [PATCH] 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 or when --zap is used) and then type something else. This https://savannah.gnu.org/bugs/?59655. Requested-by: Noam Sondak --- src/search.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/search.c b/src/search.c index 24290816..125119ee 100644 --- a/src/search.c +++ b/src/search.c @@ -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();