commit 856a6ecde33726a00d02c1633b0da7af9665ebd3
parent e3532030106a6c0775f8a1a4e73d246d4617b782
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sat, 12 Dec 2020 14:48:59 +0100
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>
Diffstat:
1 file changed, 9 insertions(+), 0 deletions(-)
diff --git 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();