Brad Bishop | 79641f2 | 2019-09-10 07:20:22 -0400 | [diff] [blame^] | 1 | From ef1fa9bef497d9491a51017f3cad0135a23bb0b4 Mon Sep 17 00:00:00 2001 |
| 2 | From: Changqing Li <changqing.li@windriver.com> |
| 3 | Date: Tue, 20 Aug 2019 17:33:15 +0800 |
| 4 | Subject: [PATCH] readline.c: fix cannot get history |
| 5 | |
| 6 | if history_offset not increate when add history, |
| 7 | it will make current history event not align with offset, |
| 8 | and cannot get history correctly. |
| 9 | |
| 10 | Upstream-Status: Submitted [tech-userlevel@NetBSD.org] |
| 11 | |
| 12 | Signed-off-by: Changqing Li <changqing.li@windriver.com> |
| 13 | --- |
| 14 | src/readline.c | 3 +++ |
| 15 | 1 file changed, 3 insertions(+) |
| 16 | |
| 17 | diff --git a/src/readline.c b/src/readline.c |
| 18 | index 43ac5bd..54b0548 100644 |
| 19 | --- a/src/readline.c |
| 20 | +++ b/src/readline.c |
| 21 | @@ -1476,7 +1476,10 @@ add_history(const char *line) |
| 22 | if (ev.num == history_length) |
| 23 | history_base++; |
| 24 | else |
| 25 | + { |
| 26 | + history_offset++; |
| 27 | history_length = ev.num; |
| 28 | + } |
| 29 | return 0; |
| 30 | } |
| 31 | |
| 32 | -- |
| 33 | 2.7.4 |
| 34 | |