Sunday, September 5, 2010

Fun with linenoise

Well, it's been a fairly productive night; I've managed to conclude the days research, take care of a few odds and ends, plus wrap up a few changes to linenoise. It's essentially a micro-library for giving console programs capabilities for line editing,like GNU readline—sans the migraine headache.

On/off I've been tinkering with it since mid August. The linenoise API has almost everything you could want except for a few minor things, and it is insanely easy to use. As to what's lacking: some common keybindings, direct access to the loaded history, and a completion hook. None of which is hard to add. Since it's so damn nicer to use than readline, but lacking a few keybindings that I've come to rely on; I've been adding them to my own fork on github. Pull requests periodically sent to the author of course. It will likely be my first choice whenever requiring line editing support in one of my applications.

Two things that interest me also, is a Windows port and implementing completion. The former is a bit of work, where as the latter is only an intellectual issue: what keystroke to use. Using tab is an issue, in that one has to be able to figure out when to insert a tab and when to trigger completion. Something more like the (real) korn shells "escape escape" provides the simplest means.

Linenoise is just one of the many things on the back burner that I would like to bring closer to the front flame.

No comments:

Post a Comment