-
-
Notifications
You must be signed in to change notification settings - Fork 37
Description
Just compiled bestline_example and tried its Unicode-handling, because I looking for a replacement of a hacked version of linenoise with partial Unicode support.
The following was run in a terminal of size 80x24 in a gnome terminal window on Ubuntu 21.10.
$ echo $TERM
xterm-256color
The initial prompt is hello> , which is fine.
Pasting the string 💩🍺🌧 ⛈ 🌩 ⚡🔥💥🌨 "ሰማይ አይታረስ ንጉሥ አይከሰስ። into bestline also works fine.
Now when pasting the same string 💩🍺🌧 ⛈ 🌩 ⚡🔥💥🌨 "ሰማይ አይታረስ ንጉሥ አይከሰስ። again, the line would be longer than 80 characters, so bestline wraps the line (correctly).
However, on its way to there bestline prints the complete input line once again for each overflow character.
Example ("x" denotes cursor position):
Initial:
hello> x
After pasting the string once:
hello> 💩🍺🌧 ⛈ 🌩 ⚡🔥💥🌨 "ሰማይ አይታረስ ንጉሥ አይከሰስ።x
After pasting the string twice:
hello> 💩🍺🌧 ⛈ 🌩 ⚡🔥💥🌨 "ሰማይ አይታረስ ንጉሥ አይከሰስ።💩🍺🌧 ⛈ 🌩 ⚡🔥💥🌨 "ሰማይ አይታረስ ንጉሥ አ
hello> 💩🍺🌧 ⛈ 🌩 ⚡🔥💥🌨 "ሰማይ አይታረስ ንጉሥ አይከሰስ።💩🍺🌧 ⛈ 🌩 ⚡🔥💥🌨 "ሰማይ አይታረስ ንጉሥ አ
hello> 💩🍺🌧 ⛈ 🌩 ⚡🔥💥🌨 "ሰማይ አይታረስ ንጉሥ አይከሰስ።💩🍺🌧 ⛈ 🌩 ⚡🔥💥🌨 "ሰማይ አይታረስ ንጉሥ አ
hello> 💩🍺🌧 ⛈ 🌩 ⚡🔥💥🌨 "ሰማይ አይታረስ ንጉሥ አይከሰስ።💩🍺🌧 ⛈ 🌩 ⚡🔥💥🌨 "ሰማይ አይታረስ ንጉሥ አ
hello> 💩🍺🌧 ⛈ 🌩 ⚡🔥💥🌨 "ሰማይ አይታረስ ንጉሥ አይከሰስ።💩🍺🌧 ⛈ 🌩 ⚡🔥💥🌨 "ሰማይ አይታረስ ንጉሥ አ
ይከሰስ።x
This should instead be just
hello> 💩🍺🌧 ⛈ 🌩 ⚡🔥💥🌨 "ሰማይ አይታረስ ንጉሥ አይከሰስ።💩🍺🌧 ⛈ 🌩 ⚡🔥💥🌨 "ሰማይ አይታረስ ንጉሥ አ
ይከሰስ።x
As a follow-up, I was trying to go down in history (pressing the down arrow key), which brings up the last used line.
It provides the correct line, but pressing it several times moves everything else up even one line. This shouldn't be the case because when there is room to display the last full history entry, nothing should be moved around.
Thanks for the amazing work on bestline! IMO a modern linenoise successor is much needed!