Linenoise - A minimal, zero-config, BSD licensed, readline replacement
github.com
github.com
* Ctrl-B seems to make the cursor go forward, instead of backward. * Ctrl-T could transpose two characters, but also goes forward. * Ctrl-P/Ctrl-N could act as up and down arrow keys, too.
And I'm not sure if Ctrl-D should do anything by default, but I pressed it instinctively expecting it to close the (example) program.
And thanks a LOT for writing this; as I'm sure you know, the GPLed readline has caused a lot of heartburn for years and years.
And it adds to your editing toolkit, you can not only transpose two characters, you can also drag one a few positions forward, which for the way I (mis)type is useful ^_^.
rlfe [1] is a wrapper that allows "any" program to use readline. At one point I hacked this so that I could get decent line editing in Matlab [2]. Matlab is particularly bad for inputs longer than a single line. The problem is that I then lost the native tab-completion support in Matlab and gave up.
[1] http://per.bothner.com/software/#rlfe — Debian package available, and presumably for some other distros too.
actually rlwrap and readline are not doing at all the same thing, but are instead solving the same problem. In fact rlwrap uses readline itself in order to wrap another executable missing line editing support.
Linenoise instead is intended to be an alternative to libreadline itself in order to provide built-in line editing capabilities.
On the other hand readline has brought more than one program into the realm of the GPL, so they certainly achieved some of their political goals.
One feature I like about rlwrap is the persistent history.
It might be nice to build this into Linenoise as an option, rather than having to roll your own for every tool you use it on.
Antirez: if you think it's a worthy feature I might be willing to submit a patch. I think I might use this for the Narwhal and Objective-J REPLs.
There's no unicode support at all.
I also miss a lot of features most would take for granted in a line editor. Deleting and jumping between entire words, simple (or not-so-simple) history search are just a couple common and useful features.
Right, this is not compatible with readline, so people can't use it as a fallback. Now who's going to depend on a 400sloc library only to get a prompt and forward/backward & line-wise history movement with hardcoded non-personalizable bindings? Surely one can do that in seventy lines? ;)
You've got a lot of code to write; the line editing capabilities of the common libraries aren't as minimal as some may think. Of course you can just ignore all of it and say that other people don't need these features because you never used them.
Having said all that, I don't have anything against the idea of seeing another BSD-licensed line editing library prosper. If you want to do it, go for it! If the basic features get there, I'll embrace the project. In the meanwhile, I'll sit back and promote libedit.