jart / bestline

ANSI Standard X3.64 Teletypewriter Command Session Library
Other
443 stars 29 forks source link

[Question] How does it compare to `replxx`? #1

Closed alexey-milovidov closed 2 years ago

alexey-milovidov commented 2 years ago

We are using https://github.com/AmokHuginnsson/replxx/ in ClickHouse. It is also a self-contained alternative to readline with many needed features comparing to linenoise.

How does bestline compares to replxx in terms of feature set and usability?

alexey-milovidov commented 2 years ago

See also #5.

I've tested performance of bestline comparing to the fork of replxx currently used in clickhouse-client. The test is: paste megabyte of Привет. Привет. Привет. Привет. Привет. Привет. Привет. Привет. Привет. Привет. Привет. Привет. Привет. Привет. Привет. Привет. Привет. Привет. Привет. Привет. Привет. Привет. Привет. ...

replxx works perfectly fine (paste takes about one second). bestline get hung:

milovidov@milovidov-desktop:~/work/bestline$ ./bestline_example
hello> Привет. Привет. Привет. Привет. Привет. Привет. Привет. Привет. Привет. Привет. Привет. Привет. Привет. Привет. Привет. Привет. Привет. Привет. Привет. Привет

in

(gdb) bt
#0  0x00007fc59e67d1e7 in __GI___libc_write (fd=1, buf=0x1145680, nbytes=388) at ../sysdeps/unix/sysv/linux/write.c:26
#1  0x0000000000402e98 in bestlineWrite ()
#2  0x00000000004047e1 in bestlineRefreshLine ()
#3  0x0000000000404f06 in bestlineEditInsert ()
#4  0x00000000004028d1 in bestlineEdit ()
#5  0x0000000000401e44 in bestlineRaw ()
#6  0x00000000004029f2 in bestline ()
#7  0x0000000000407892 in main ()

And does not finish in minutes. And also while it is being hung it's not possible to interrupt it with Ctrl+C.

(It happens if Konsole is used as terminal emulator)

amosbird commented 2 years ago

Btw recent replxx supports multiple line editing

jart commented 2 years ago

@alexey-milovidov per your feedback I've made the maximum line length unlimited and ensured that it's efficient. I believe Bestline should now be able to handle the case of a line being larger than the terminal display even better than GNU Readline does now.

bestline2

Enjoy!

As for replxx I don't know because I've never used it. Depending on the STL would be an immediate deal breaker for me, since I like to be able to produce 40kb static executable files, and I wouldn't want something as simple as a line reader to preclude me from having that.

alexey-milovidov commented 2 years ago

Thank you! :+1: Also one important thing is the possibility to add user-defined syntax highlighting.