From 7a1709f03b0e4c012314cb6c49b6c6726dea8d60 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Thu, 21 Jan 2016 18:23:17 +0000 Subject: [PATCH] Removing a now unneeded function, as nothing can break out of do_prompt() any more, not a SIGWINCH either. And deleting an always-FALSE 'if'. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5577 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 3 +++ src/nano.c | 4 ---- src/prompt.c | 27 --------------------------- 3 files changed, 3 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6a46379c..f340b16e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ * src/prompt.c (get_prompt_string): Preserve the cursor position on the statusbar when just toggling a setting or making an excursion to the file browser. This fixes Savannah bug #46945. + * src/prompt.c (do_prompt_abort): Remove this unneeded function, as + nothing can break out of do_prompt(), not a SIGWINCH either. + * src/prompt.c (get_prompt_string): Delete code that is dead now. 2016-01-20 Benno Schulenberg * src/files.c (open_buffer): Readjust the indentation and a comment. diff --git a/src/nano.c b/src/nano.c index 46c78b6b..00faa806 100644 --- a/src/nano.c +++ b/src/nano.c @@ -2683,10 +2683,6 @@ int main(int argc, char **argv) reset_cursor(); wnoutrefresh(edit); - /* Just in case we were at the statusbar prompt, make sure the - * statusbar cursor position is reset. */ - do_prompt_abort(); - /* If constant cursor position display is on, and there are no * keys waiting in the input buffer, display the current cursor * position on the statusbar. */ diff --git a/src/prompt.c b/src/prompt.c index 72a713ca..b3c1946c 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -37,9 +37,6 @@ static size_t old_statusbar_x = (size_t)-1; /* The old cursor position in answer, if any. */ static size_t old_pww = (size_t)-1; /* The old place we want in answer, if any. */ -static bool reset_statusbar_x = FALSE; - /* Should we reset the cursor position at the statusbar - * prompt? */ /* Read in a character, interpret it as a shortcut or toggle if * necessary, and return it. @@ -761,19 +758,6 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs, answer = mallocstrcpy(answer, curranswer); curranswer_len = strlen(answer); - /* If reset_statusbar_x is TRUE, restore statusbar_x and - * statusbar_pww to what they were before this prompt. Then, if - * statusbar_x is uninitialized or past the end of curranswer, put - * statusbar_x at the end of the string and update statusbar_pww - * based on it. We do these things so that the cursor position - * stays at the right place if a prompt-changing toggle is pressed, - * or if this prompt was started from another prompt and we cancel - * out of it. */ - if (reset_statusbar_x) { - statusbar_x = old_statusbar_x; - statusbar_pww = old_pww; - } - if (statusbar_x == (size_t)-1 || statusbar_x > curranswer_len) { statusbar_x = curranswer_len; statusbar_pww = statusbar_xplustabs(); @@ -1019,17 +1003,6 @@ int do_prompt(bool allow_tabs, return retval; } -/* This function forces a reset of the statusbar cursor position. It - * should be called when we get out of all statusbar prompts. */ -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; -} - /* Ask a simple Yes/No (and optionally All) question, specified in msg, * on the statusbar. Return 1 for Yes, 0 for No, 2 for All (if all is * TRUE when passed in), and -1 for Cancel. */