display: do spotlighting as part of drawing the screen
When something is spotlighted, it should survive a refresh of the screen and an excursion to a help text, so the spotlight should get painted whenever the edit window is drawn. This fully fixes https://savannah.gnu.org/bugs/?54721.master
parent
7ea6d6bbda
commit
c2e4f77594
|
@ -259,6 +259,13 @@ char *rcfile_with_errors = NULL;
|
||||||
/* The first nanorc file, if any, that produced warnings. */
|
/* The first nanorc file, if any, that produced warnings. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool spotlighted = FALSE;
|
||||||
|
/* Whether any text is spotlighted. */
|
||||||
|
size_t light_from_col = 0;
|
||||||
|
/* Where the spotlighted text starts. */
|
||||||
|
size_t light_to_col = 0;
|
||||||
|
/* Where the spotlighted text ends. */
|
||||||
|
|
||||||
/* Return the number of entries in the shortcut list for a given menu. */
|
/* Return the number of entries in the shortcut list for a given menu. */
|
||||||
size_t length_of_list(int menu)
|
size_t length_of_list(int menu)
|
||||||
{
|
{
|
||||||
|
|
|
@ -175,6 +175,10 @@ extern char *statedir;
|
||||||
extern char *rcfile_with_errors;
|
extern char *rcfile_with_errors;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern bool spotlighted;
|
||||||
|
extern size_t light_from_col;
|
||||||
|
extern size_t light_to_col;
|
||||||
|
|
||||||
typedef void (*functionptrtype)(void);
|
typedef void (*functionptrtype)(void);
|
||||||
|
|
||||||
/* Most functions in browser.c. */
|
/* Most functions in browser.c. */
|
||||||
|
|
|
@ -575,19 +575,18 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
|
||||||
numreplaced = 0;
|
numreplaced = 0;
|
||||||
|
|
||||||
if (!replaceall) {
|
if (!replaceall) {
|
||||||
size_t from_col = xplustabs();
|
spotlighted = TRUE;
|
||||||
size_t to_col = strnlenpt(openfile->current->data,
|
light_from_col = xplustabs();
|
||||||
|
light_to_col = strnlenpt(openfile->current->data,
|
||||||
openfile->current_x + match_len);
|
openfile->current_x + match_len);
|
||||||
|
|
||||||
/* Refresh the edit window, scrolling it if necessary. */
|
/* Refresh the edit window, scrolling it if necessary. */
|
||||||
edit_refresh();
|
edit_refresh();
|
||||||
|
|
||||||
spotlight(TRUE, from_col, to_col);
|
|
||||||
|
|
||||||
/* TRANSLATORS: This is a prompt. */
|
/* TRANSLATORS: This is a prompt. */
|
||||||
i = do_yesno_prompt(TRUE, _("Replace this instance?"));
|
i = do_yesno_prompt(TRUE, _("Replace this instance?"));
|
||||||
|
|
||||||
spotlight(FALSE, from_col, to_col);
|
spotlighted = FALSE;
|
||||||
|
|
||||||
if (i == -1) /* The replacing was cancelled. */
|
if (i == -1) /* The replacing was cancelled. */
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -2584,21 +2584,20 @@ bool fix_spello(const char *word)
|
||||||
proceed = TRUE;
|
proceed = TRUE;
|
||||||
napms(2800);
|
napms(2800);
|
||||||
} else if (result == 1) {
|
} else if (result == 1) {
|
||||||
size_t from_col = xplustabs();
|
spotlighted = TRUE;
|
||||||
size_t to_col = from_col + strlenpt(word);
|
light_from_col = xplustabs();
|
||||||
|
light_to_col = light_from_col + strlenpt(word);
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
filestruct *saved_mark = openfile->mark;
|
filestruct *saved_mark = openfile->mark;
|
||||||
openfile->mark = NULL;
|
openfile->mark = NULL;
|
||||||
#endif
|
#endif
|
||||||
edit_refresh();
|
edit_refresh();
|
||||||
|
|
||||||
spotlight(TRUE, from_col, to_col);
|
|
||||||
|
|
||||||
/* Let the user supply a correctly spelled alternative. */
|
/* Let the user supply a correctly spelled alternative. */
|
||||||
proceed = (do_prompt(FALSE, FALSE, MSPELL, word, NULL,
|
proceed = (do_prompt(FALSE, FALSE, MSPELL, word, NULL,
|
||||||
edit_refresh, _("Edit a replacement")) != -1);
|
edit_refresh, _("Edit a replacement")) != -1);
|
||||||
|
|
||||||
spotlight(FALSE, from_col, to_col);
|
spotlighted = FALSE;
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
openfile->mark = saved_mark;
|
openfile->mark = saved_mark;
|
||||||
|
|
|
@ -2780,6 +2780,9 @@ int update_line(filestruct *fileptr, size_t index)
|
||||||
if (strlenpt(fileptr->data) > from_col + editwincols)
|
if (strlenpt(fileptr->data) > from_col + editwincols)
|
||||||
mvwaddch(edit, row, COLS - 1, '$');
|
mvwaddch(edit, row, COLS - 1, '$');
|
||||||
|
|
||||||
|
if (spotlighted && !inhelp)
|
||||||
|
spotlight(TRUE, light_from_col, light_to_col);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2846,6 +2849,9 @@ int update_softwrapped_line(filestruct *fileptr)
|
||||||
from_col = to_col;
|
from_col = to_col;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (spotlighted && !inhelp)
|
||||||
|
spotlight(TRUE, light_from_col, light_to_col);
|
||||||
|
|
||||||
return (row - starting_row);
|
return (row - starting_row);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue