nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/4] search: set the mark at the end of a found match so it gets


From: Benno Schulenberg
Subject: [PATCH 1/4] search: set the mark at the end of a found match so it gets highlighted
Date: Sun, 20 Dec 2020 17:04:29 +0100

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>
---
 src/search.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/search.c b/src/search.c
index c0c89804..668c5d71 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();
-- 
2.29.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]