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: David Lawrence Ramsey <pooka109@gmail.com>
master
Benno Schulenberg 2017-05-03 12:41:24 +02:00
parent 3d1ef8e07f
commit 9c2bc68847
4 changed files with 12 additions and 4 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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