diff options
author | Mark Kettenis <kettenis@gnu.org> | 2002-08-18 12:39:03 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@gnu.org> | 2002-08-18 12:39:03 +0000 |
commit | b5686e99e9c6845aaf1da8af76e1f55f60a626c9 (patch) | |
tree | 60f3787c09a6adebbee095974f4e6569e492236c | |
parent | c1bab85b70f0944db725358c3b6aec6ddaa4543c (diff) | |
download | gdb-b5686e99e9c6845aaf1da8af76e1f55f60a626c9.zip gdb-b5686e99e9c6845aaf1da8af76e1f55f60a626c9.tar.gz gdb-b5686e99e9c6845aaf1da8af76e1f55f60a626c9.tar.bz2 |
* top.c (gdb_rl_operate_and_get_next): Make sure
operate-and-get-next functions correctly even when the history
list is completely filled.
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/top.c | 18 |
2 files changed, 22 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7433411..2307b20 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2002-08-17 Mark Kettenis <kettenis@gnu.org> + + * top.c (gdb_rl_operate_and_get_next): Make sure + operate-and-get-next functions correctly even when the history + list is completely filled. + 2002-08-18 Andrew Cagney <ac131313@redhat.com> * MAINTAINERS (Target Instruction Set Architectures): Rename @@ -1082,6 +1082,8 @@ gdb_rl_operate_and_get_next_completion (void) static int gdb_rl_operate_and_get_next (int count, int key) { + int where; + if (event_loop_p) { /* Use the async hook. */ @@ -1094,8 +1096,20 @@ gdb_rl_operate_and_get_next (int count, int key) rl_pre_input_hook = (Function *) gdb_rl_operate_and_get_next_completion; } - /* Add 1 because we eventually want the next line. */ - operate_saved_history = where_history () + 1; + /* Find the current line, and find the next line to use. */ + where = where_history(); + + /* FIXME: kettenis/20020817: max_input_history is renamed into + history_max_entries in readline-4.2. When we do a new readline + import, we should probably change it here too, even though + readline maintains backwards compatibility for now by still + defining max_input_history. */ + if ((history_is_stifled () && (history_length >= max_input_history)) || + (where >= history_length - 1)) + operate_saved_history = where; + else + operate_saved_history = where + 1; + return rl_newline (1, key); } |