[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/4] search: just highlight the found occurrence, instead of mark
From: |
Benno Schulenberg |
Subject: |
[PATCH 1/4] search: just highlight the found occurrence, instead of marking it |
Date: |
Tue, 2 Feb 2021 15:20:35 +0100 |
Requested-by: Peter Passchier <peter@passchier.net>
---
src/help.c | 2 +-
src/nano.c | 5 +++++
src/search.c | 8 ++++----
src/winio.c | 4 ++--
4 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/src/help.c b/src/help.c
index b497f548..0b6b235e 100644
--- a/src/help.c
+++ b/src/help.c
@@ -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) {
diff --git a/src/nano.c b/src/nano.c
index 6c5eda5e..1df6736c 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -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;
diff --git a/src/search.c b/src/search.c
index 0238cc85..bb81cf21 100644
--- a/src/search.c
+++ b/src/search.c
@@ -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
diff --git a/src/winio.c b/src/winio.c
index a70d9004..cffc5fd8 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -2845,7 +2845,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;
@@ -2906,7 +2906,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);
--
2.29.2
- [PATCH 1/4] search: just highlight the found occurrence, instead of marking it,
Benno Schulenberg <=