X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=readline%2Fhistsearch.c;h=1cc5875a4b41f6b65821e77a01affe2abd23398f;hb=5bdf8622148be4764cc0757fd5b3e41f4d73b2b2;hp=d94fd6cd9c656b1acdf8af91ae59e3529b201f97;hpb=7f8411279d59ee620d1e2e153329c0bd47c4ca86;p=deliverable%2Fbinutils-gdb.git diff --git a/readline/histsearch.c b/readline/histsearch.c index d94fd6cd9c..1cc5875a4b 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)