Switching the cursor on and off at the appropriate moments (that is: when

needed), so that it no longer shows in the help screen nor in the file list.
This fixes Savannah bug #47126.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5640 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2016-02-13 19:41:12 +00:00
parent ec3cd1eeae
commit 568d2a389c
9 changed files with 23 additions and 22 deletions

View File

@ -4,6 +4,9 @@
fixes Savannah bug #47133.
* src/files.c (save_poshistory): Allocate enough space for printing
out the line and column numbers. This fixes Savannah bug #47135.
* src/*.c: Switch the cursor on and off at the appropriate moments,
so that it no longer shows in the help screen nor in the file list.
This fixes Savannah bug #47126.
GNU nano 2.5.2 - 2016.02.12

View File

@ -61,6 +61,7 @@ char *do_browser(char *path, DIR *dir)
functionptrtype func;
/* The function of the key the user typed in. */
/* Don't show a cursor in the file list. */
curs_set(0);
blank_statusbar();
bottombars(MBROWSER);
@ -115,6 +116,9 @@ char *do_browser(char *path, DIR *dir)
/* The path we switch to at the "Go to Directory"
* prompt. */
/* Make sure that the cursor is off. */
curs_set(0);
#ifndef NANO_TINY
if (kbinput == KEY_WINCH) {
/* Rebuild the file list and sort it. */
@ -180,15 +184,12 @@ char *do_browser(char *path, DIR *dir)
do_help_void();
/* The window dimensions might have changed, so act as if. */
kbinput = KEY_WINCH;
curs_set(0);
#else
say_there_is_no_help();
#endif
} else if (func == do_search) {
/* Search for a filename. */
curs_set(1);
do_filesearch();
curs_set(0);
} else if (func == do_research) {
/* Search for another filename. */
do_fileresearch();
@ -207,7 +208,6 @@ char *do_browser(char *path, DIR *dir)
selected = filelist_len - 1;
} else if (func == goto_dir_void) {
/* Go to a specific directory. */
curs_set(1);
i = do_prompt(TRUE,
#ifndef DISABLE_TABCOMP
FALSE,
@ -219,7 +219,6 @@ char *do_browser(char *path, DIR *dir)
/* TRANSLATORS: This is a prompt. */
browser_refresh, _("Go To Directory"));
curs_set(0);
bottombars(MBROWSER);
/* If the directory begins with a newline (i.e. an
@ -346,7 +345,6 @@ char *do_browser(char *path, DIR *dir)
}
titlebar(NULL);
edit_refresh();
curs_set(1);
if (old_const_update)
SET(CONST_UPDATE);

View File

@ -2907,7 +2907,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
blank_edit();
wmove(edit, 0, 0);
/* Disable el cursor. */
/* Don't show a cursor in the list of completions. */
curs_set(0);
for (match = 0; match < num_matches; match++) {
@ -2946,9 +2946,6 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
if (!*list)
refresh_func();
/* Enable el cursor. */
curs_set(1);
return buf;
}
#endif /* !DISABLE_TABCOMP */

View File

@ -56,6 +56,7 @@ void do_help(void)
functionptrtype func;
/* The function of the key the user typed in. */
/* Don't show a cursor in the help screen. */
curs_set(0);
blank_edit();
blank_statusbar();
@ -123,7 +124,6 @@ void do_help(void)
#ifndef NANO_TINY
if (kbinput == KEY_WINCH) {
kbinput = ERR;
curs_set(0);
continue; /* Redraw the screen. */
}
#endif
@ -174,8 +174,6 @@ void do_help(void)
} else
bottombars(oldmenu);
curs_set(1);
#ifndef DISABLE_BROWSER
if (oldmenu == MBROWSER || oldmenu == MWHEREISFILE || oldmenu == MGOTODIR)
browser_refresh();

View File

@ -1099,8 +1099,6 @@ int no_help(void)
* name with the TEMP_FILE flag set, just before the filename prompt. */
void no_current_file_name_warning(void)
{
curs_set(0);
/* Warn that the current file has no name. */
statusbar(_("No file name"));
beep();
@ -2676,6 +2674,9 @@ int main(int argc, char **argv)
currmenu = MMAIN;
/* Turn the cursor on when waiting for input. */
curs_set(1);
/* Read in and interpret characters. */
do_input(TRUE);
}

View File

@ -610,6 +610,9 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
* this case, disable all keys that would change the text if the
* filename isn't blank and we're at the "Write File" prompt. */
while (TRUE) {
/* Ensure the cursor is on when waiting for input. */
curs_set(1);
kbinput = do_statusbar_input(&ran_func, &finished, refresh_func);
assert(statusbar_x <= strlen(answer));

View File

@ -710,6 +710,7 @@ ssize_t do_replace_loop(
edit_refresh();
/* Don't show cursor, to not distract from highlighted match. */
curs_set(0);
do_replace_highlight(TRUE, exp_word);
@ -721,8 +722,6 @@ ssize_t do_replace_loop(
free(exp_word);
curs_set(1);
if (i == -1) { /* We canceled the replace. */
if (canceled != NULL)
*canceled = TRUE;

View File

@ -3130,8 +3130,11 @@ void do_linter(void)
char *msg = charalloc(1024 + strlen(curlint->filename));
int i;
sprintf(msg, _("This message is for unopened file %s, open it in a new buffer?"),
sprintf(msg, _("This message is for unopened file %s,"
" open it in a new buffer?"),
curlint->filename);
/* Show a cursor after the question. */
curs_set(1);
i = do_yesno_prompt(FALSE, msg);
free(msg);
if (i == -1) {
@ -3163,6 +3166,9 @@ void do_linter(void)
bottombars(MLINTER);
}
/* Show the cursor to indicate the affected line. */
curs_set(1);
kbinput = get_kbinput(bottomwin);
#ifndef NANO_TINY

View File

@ -311,9 +311,6 @@ int get_kbinput(WINDOW *win)
{
int kbinput;
/* Turn the cursor on when waiting for input. */
curs_set(1);
/* Read in a character and interpret it. Continue doing this until
* we get a recognized value or sequence. */
while ((kbinput = parse_kbinput(win)) == ERR)
@ -3354,7 +3351,6 @@ void do_credits(void)
UNSET(NO_HELP);
window_init();
curs_set(1);
nodelay(edit, FALSE);
total_refresh();