Commit 9c2bc688 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

help: after a search, show the cursor only when something was found

And hide the cursor again as soon as the user scrolls.
Achieve this through making the 'didfind' variable global.

Also, remove a superfluous call of wnoutrefresh(), as bottombars()
already does that.

This fixes https://savannah.gnu.org/bugs/?50918

.
Reported-by: default avatarDavid Lawrence Ramsey <pooka109@gmail.com>
parent 3d1ef8e0
Showing with 12 additions and 4 deletions
+12 -4
......@@ -68,6 +68,9 @@ bool inhelp = FALSE;
char *title = NULL;
/* When not NULL: the title of the current help text. */
int didfind = 0;
/* Whether the last search found something. */
int controlleft, controlright, controlup, controldown, controlhome, controlend;
#ifndef NANO_TINY
int shiftcontrolleft, shiftcontrolright, shiftcontrolup, shiftcontroldown;
......
......@@ -183,6 +183,7 @@ void do_help(void)
while (TRUE) {
lastmessage = HUSH;
focusing = TRUE;
didfind = 0;
kbinput = get_kbinput(edit);
......@@ -207,12 +208,9 @@ void do_help(void)
} else if (func == do_search) {
do_search();
bottombars(MHELP);
wnoutrefresh(bottomwin);
curs_set(1);
} else if (func == do_research) {
do_research();
currmenu = MHELP;
curs_set(1);
#ifndef NANO_TINY
} else if (kbinput == KEY_WINCH) {
; /* Nothing to do. */
......@@ -229,6 +227,12 @@ void do_help(void)
} else
unbound_key(kbinput);
/* If we searched and found something, let the cursor show it. */
if (didfind == 1)
curs_set(1);
else
curs_set(0);
edit_refresh();
location = 0;
......
......@@ -54,6 +54,8 @@ extern filestruct *pletion_line;
extern bool inhelp;
extern char *title;
extern int didfind;
extern int controlleft;
extern int controlright;
extern int controlup;
......
......@@ -438,7 +438,6 @@ void go_looking(void)
{
filestruct *was_current = openfile->current;
size_t was_current_x = openfile->current_x;
int didfind;
#ifdef DEBUG
clock_t start = clock();
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment