make sure that the statusbar cursor position is always properly reset

when we get out of all statusbar prompts


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3865 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2006-08-29 20:54:38 +00:00
parent 185dc6acd0
commit 3879528945
4 changed files with 16 additions and 13 deletions

View File

@ -1,4 +1,9 @@
CVS code - CVS code -
- General:
- Make sure that the statusbar cursor position is always
properly reset when we get out of all statusbar prompts.
Changes to do_insertfile(), do_writeout(),
handle_sigwinch(), main(), and do_prompt_abort(). (DLR)
GNU nano 1.9.99pre1 - 2006.08.29 GNU nano 1.9.99pre1 - 2006.08.29
- General: - General:

View File

@ -766,13 +766,11 @@ void do_insertfile(
if (tmp == NULL) if (tmp == NULL)
continue; continue;
/* We have a file now. Indicate this. */
free(answer); free(answer);
answer = tmp; answer = tmp;
/* We have a file now. Indicate this and get out of the
* statusbar prompt cleanly. */
i = 0; i = 0;
do_prompt_abort();
} }
#endif #endif
@ -1825,12 +1823,9 @@ int do_writeout(bool exiting)
if (tmp == NULL) if (tmp == NULL)
continue; continue;
/* We have a file now. Indicate this. */
free(answer); free(answer);
answer = tmp; answer = tmp;
/* We have a file now. Get out of the statusbar prompt
* cleanly. */
do_prompt_abort();
} else } else
#endif /* !DISABLE_BROWSER */ #endif /* !DISABLE_BROWSER */
#ifndef NANO_TINY #ifndef NANO_TINY

View File

@ -1088,10 +1088,6 @@ RETSIGTYPE handle_sigwinch(int signal)
COLS = win.ws_col; COLS = win.ws_col;
LINES = win.ws_row; LINES = win.ws_row;
/* Just in case we're in the statusbar prompt, reset the statusbar
* cursor position. */
do_prompt_abort();
/* If we've partitioned the filestruct, unpartition it now. */ /* If we've partitioned the filestruct, unpartition it now. */
if (filepart != NULL) if (filepart != NULL)
unpartition_filestruct(&filepart); unpartition_filestruct(&filepart);
@ -2252,6 +2248,10 @@ int main(int argc, char **argv)
/* Read in and interpret characters. */ /* Read in and interpret characters. */
do_input(&meta_key, &func_key, &s_or_t, &ran_func, &finished, do_input(&meta_key, &func_key, &s_or_t, &ran_func, &finished,
TRUE); TRUE);
/* Just in case we were in the statusbar prompt, reset the
* statusbar cursor position. */
do_prompt_abort();
} }
/* We should never get here. */ /* We should never get here. */

View File

@ -1247,10 +1247,13 @@ int do_prompt(bool allow_tabs,
} }
/* This function forces a reset of the statusbar cursor position. It /* This function forces a reset of the statusbar cursor position. It
* should only be called after do_prompt(), and is only needed if we * should be called when we get out of all statusbar prompts. */
* leave the prompt via something other than Cancel or Enter. */
void do_prompt_abort(void) void do_prompt_abort(void)
{ {
/* Uninitialize the old cursor position in answer. */
old_statusbar_x = (size_t)-1;
old_pww = (size_t)-1;
reset_statusbar_x = TRUE; reset_statusbar_x = TRUE;
} }