summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2016-05-31 16:02:42 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2016-05-31 16:02:42 +0000
commit88a1606185d0d0148f6333ebedd9bd4d30609a2f (patch)
tree8d05cf412d0a8494bb91b2fbb84ce54ca77d4d0a
parent91bef5693d31f31ecf41bee603aa1d6abafa7d4d (diff)
The argument of remove_history() only counts existing entries,
not those that were previously deleted.
-rw-r--r--regress/lib/libedit/readline/history.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/regress/lib/libedit/readline/history.c b/regress/lib/libedit/readline/history.c
index 002b74d66d8..57001e7eb61 100644
--- a/regress/lib/libedit/readline/history.c
+++ b/regress/lib/libedit/readline/history.c
@@ -150,6 +150,7 @@ test_remove(void)
add_history("111");
add_history("222");
add_history("333");
+ add_history("444");
/* Remove the second item "222"; the index is zero-based. */
remove_history(1);
@@ -171,6 +172,12 @@ test_remove(void)
if (he == NULL || strcmp(he->line, "333") != 0)
ok = 0;
+ /* Remove the new second item "333". */
+ remove_history(1);
+ he = history_get(history_base + 1);
+ if (he == NULL || strcmp(he->line, "444") != 0)
+ ok = 0;
+
clear_history();
return ok;
}