Readline 5.1 import for HEAD.
[deliverable/binutils-gdb.git] / readline / histsearch.c
index d94fd6cd9c656b1acdf8af91ae59e3529b201f97..1cc5875a4b41f6b65821e77a01affe2abd23398f 100644 (file)
@@ -77,11 +77,11 @@ history_search_internal (string, direction, anchored)
   if (string == 0 || *string == '\0')
     return (-1);
 
-  if (!history_length || ((i == history_length) && !reverse))
+  if (!history_length || ((i >= history_length) && !reverse))
     return (-1);
 
-  if (reverse && (i == history_length))
-    i--;
+  if (reverse && (i >= history_length))
+    i = history_length - 1;
 
 #define NEXT_LINE() do { if (reverse) i--; else i++; } while (0)
 
This page took 0.022586 seconds and 4 git commands to generate.