Hi,
First, if this is not the right place to send the patch,
please let me know, thanks.
There is a bug in readline.c, here is reproduce steps and
patch to fix it, @christos, please help to review it, thanks.
Reproduce steps:
1. Download libedit from https://www.thrysoee.dk/editline/
2. config and build libedit, and then run fileman under
examples folder
3. history command not work, no history is outputted.
FileMan: help
cd Change to directory DIR.
delete Delete FILE.
help Display this text.
? Synonym for `help'.
list List files in DIR.
ls Synonym for `list'.
pwd Print the current working directory.
quit Quit using Fileman.
rename Rename FILE to NEWNAME.
stat Print out statistics on FILE.
view View the contents of FILE.
history List editline history.
FileMan: history
FileMan:
Expect result:
FileMan: help
cd Change to directory DIR.
delete Delete FILE.
help Display this text.
? Synonym for `help'.
list List files in DIR.
ls Synonym for `list'.
pwd Print the current working directory.
quit Quit using Fileman.
rename Rename FILE to NEWNAME.
stat Print out statistics on FILE.
view View the contents of FILE.
history List editline history.
FileMan: history
help
history
FileMan:
4. libedit use readline.c v1.151
Patch:
--- readline.c 2019-08-20 17:05:28.338507034 +0800
+++ readline.c.orig 2019-08-20 17:04:19.724864404 +0800
@@ -1476,11 +1476,7 @@
if (ev.num == history_length)
history_base++;
else
- {
- history_offset++;
- history_length = ev.num;
- }
-
+ history_length = ev.num;
return 0;
}
if history_offset not increate when add history, it will make
current history event
not align with offset, and cannot get history correctly. and
problem caused by this
commit:
http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libedit/readline.c.diff?r1=1.136&r2=1.137&_only_with_tag_=MAIN&f=h
--
BRs
Sandy(Li Changqing)