From: Chris Allegretta Date: Tue, 3 Jun 2008 08:09:05 +0000 (+0000) Subject: Add a fix for bug #23144 that actually works (several bugs in one here) X-Git-Tag: v2.1.2~3 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=1b6ed07543c21f0bb2078d2884de78d9a5b0d3e8;p=nano.git Add a fix for bug #23144 that actually works (several bugs in one here) git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4264 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index 8ef02d07..9120f79e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,6 @@ 2008-05-31 Chris Allegretta - * prompt.c: Tentative fix for bug #23144: using arrow keys in - search buffer affects main window (by Mike Frysinger) + * prompt.c,search.c,global.c: Tentative fix for bug #23144: using arrow + keys in search buffer affects main window (by Mike Frysinger) 2008-05-31 Chris Allegretta * global.c: Fix for Savannah bug #23442: left/right arrow keys diff --git a/src/global.c b/src/global.c index 9896a325..3e10886d 100644 --- a/src/global.c +++ b/src/global.c @@ -1064,15 +1064,21 @@ void shortcut_init(bool unjustify) add_to_sclist(MALL, "kleft", do_left, 0, TRUE); add_to_sclist(MMAIN, "^Q", xon_complaint, 0, TRUE); add_to_sclist(MMAIN, "^S", xoff_complaint, 0, TRUE); - add_to_sclist(MALL, "^P", do_up_void, 0, TRUE); - add_to_sclist(MALL, "kup", do_up_void, 0, TRUE); - add_to_sclist(MALL, "^N", do_down_void, 0, TRUE); - add_to_sclist(MALL, "kdown", do_down_void, 0, TRUE); + add_to_sclist(MMAIN, "^P", do_up_void, 0, TRUE); + add_to_sclist(MMAIN, "kup", do_up_void, 0, TRUE); + add_to_sclist(MMAIN, "^N", do_down_void, 0, TRUE); + add_to_sclist(MMAIN, "kdown", do_down_void, 0, TRUE); add_to_sclist(MALL, "^A", do_home, 0, TRUE); add_to_sclist(MALL, "khome", do_home, 0, TRUE); add_to_sclist(MALL, "^E", do_end, 0, TRUE); add_to_sclist(MALL, "kend", do_end, 0, TRUE); #ifndef DISABLE_JUSTIFY +#ifndef NANO_TINY + add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE, "^P", (void *) prev_history_msg, 0, FALSE); + add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE, "kup", (void *) prev_history_msg, 0, FALSE); + add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE, "^N", (void *) next_history_msg, 0, FALSE); + add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE, "kdown", (void *) next_history_msg, 0, FALSE); +#endif add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2, "^W", do_para_begin_void, 0, TRUE); add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2, diff --git a/src/prompt.c b/src/prompt.c index 67f978dd..30ee75ef 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -1010,7 +1010,7 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %d\n", answer } else #endif /* !DISABLE_TABCOMP */ #ifndef NANO_TINY - if (s && s->scfunc == do_up_void) { + if (s && s->scfunc == (void *) prev_history_msg) { if (history_list != NULL) { /* If we're scrolling up at the bottom of the * history list and answer isn't blank, save answer @@ -1038,7 +1038,7 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %d\n", answer * statusbar prompt. */ finished = FALSE; } - } else if (s && s->scfunc == do_down_void) { + } else if (s && s->scfunc == (void *) next_history_msg) { if (history_list != NULL) { /* Get the newer search from the history list and * save it in answer. If there is no newer search, diff --git a/src/proto.h b/src/proto.h index 3ed75aab..c349c36d 100644 --- a/src/proto.h +++ b/src/proto.h @@ -788,6 +788,8 @@ const char *cancel_msg; #ifndef NANO_TINY const char *case_sens_msg; const char *backwards_msg; +const char *prev_history_msg; +const char *next_history_msg; #endif const char *replace_msg; const char *no_replace_msg; diff --git a/src/search.c b/src/search.c index f050e2b8..cee7ac1f 100644 --- a/src/search.c +++ b/src/search.c @@ -1383,7 +1383,7 @@ char *get_history_older(filestruct **h) assert(h != NULL); if ((*h)->prev == NULL) - return (*h)->data; + return NULL; *h = (*h)->prev; @@ -1397,7 +1397,7 @@ char *get_history_newer(filestruct **h) assert(h != NULL); if ((*h)->next == NULL) - return (*h)->data; + return NULL; *h = (*h)->next;