summaryrefslogtreecommitdiff
path: root/readline/histsearch.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <dan@debian.org>2006-04-24 22:00:27 +0000
committerDaniel Jacobowitz <dan@debian.org>2006-04-24 22:00:27 +0000
commitedc469a5506b2f0858aa4366d84f5c04e4eeeebe (patch)
treecf5d1c0b957710b8b9976bff1e8484b7c4a839b4 /readline/histsearch.c
parent7be84cf3293f63b314237035e7df76caa8022769 (diff)
downloadgdb-edc469a5506b2f0858aa4366d84f5c04e4eeeebe.tar.gz
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)