* elf64-mips.c (mips_elf64_be_swap_reloca_out): Handle type2 and type3.
[deliverable/binutils-gdb.git] / gdb / top.c
index ee3daf067844ac8fcda8dfcc8a1bc31c4260b9ed..60c1bf9c3e08e5e7774bd55f4efa99f55e0487c3 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -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);
 }
 \f
@@ -1943,6 +1957,7 @@ init_main (void)
                                 get_gdb_completer_word_break_characters ();
   rl_completer_quote_characters = get_gdb_completer_quote_characters ();
   rl_readline_name = "gdb";
+  rl_terminal_name = getenv ("TERM");
 
   /* The name for this defun comes from Bash, where it originated.
      15 is Control-o, the same binding this function has in Bash.  */
This page took 0.025356 seconds and 4 git commands to generate.