commit 1b6ed07543c21f0bb2078d2884de78d9a5b0d3e8
parent 1371fb6326935b48891dcc76057b0eae5417fdd8
Author: Chris Allegretta <chrisa@asty.org>
Date: Tue, 3 Jun 2008 08:09:05 +0000
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
Diffstat:
5 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,6 +1,6 @@
2008-05-31 Chris Allegretta <chrisa@asty.org>
- * 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 <chrisa@asty.org>
* global.c: Fix for Savannah bug #23442: left/right arrow keys
diff --git 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
@@ -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
@@ -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
@@ -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;