From a909d35bd1ac7c0151300d6be9fe4e2faf933914 Mon Sep 17 00:00:00 2001 From: christos Date: Wed, 21 Aug 2019 11:11:48 +0000 Subject: [PATCH] Increment offset when adding an element to history to keep it aligned with the last element entered (Sandy Li Changqing) --- lib/libedit/readline.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/libedit/readline.c b/lib/libedit/readline.c index 910cfdf6cb5a..dc852f5539c1 100644 --- a/lib/libedit/readline.c +++ b/lib/libedit/readline.c @@ -1,4 +1,4 @@ -/* $NetBSD: readline.c,v 1.156 2019/07/23 10:18:52 christos Exp $ */ +/* $NetBSD: readline.c,v 1.157 2019/08/21 11:11:48 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include "config.h" #if !defined(lint) && !defined(SCCSID) -__RCSID("$NetBSD: readline.c,v 1.156 2019/07/23 10:18:52 christos Exp $"); +__RCSID("$NetBSD: readline.c,v 1.157 2019/08/21 11:11:48 christos Exp $"); #endif /* not lint && not SCCSID */ #include @@ -1477,8 +1477,10 @@ add_history(const char *line) (void)history(h, &ev, H_GETSIZE); if (ev.num == history_length) history_base++; - else + else { + history_offset++; history_length = ev.num; + } return 0; }