summaryrefslogtreecommitdiff
path: root/readline/histsearch.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2006-05-05 18:26:14 +0000
committerDaniel Jacobowitz <drow@false.org>2006-05-05 18:26:14 +0000
commit5bdf8622148be4764cc0757fd5b3e41f4d73b2b2 (patch)
treeec69331983824d95160ec9a14f71d6bccd23ed42 /readline/histsearch.c
parent7f8411279d59ee620d1e2e153329c0bd47c4ca86 (diff)
downloadbinutils-gdb-5bdf8622148be4764cc0757fd5b3e41f4d73b2b2.tar.gz
Readline 5.1 import for HEAD.
Diffstat (limited to 'readline/histsearch.c')
-rw-r--r--readline/histsearch.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/readline/histsearch.c b/readline/histsearch.c
index d94fd6cd9c6..1cc5875a4b4 100644
--- a/readline/histsearch.c
+++ b/readline/histsearch.c
@@ -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)