You are here

TextInput: The Prompt

Hi,

As you have probably noticed, colors arrived at ROOT's prompt about a year ago: known types got blue, matching parentheses light up green, non-matching ones red. Nothing spectacular, except for the fact that this was done by a summer student, and that it was possible without readline. She used the editline library instead.

What's the problem with readline? This is the prompt interface library: old (good!), stable (good!), works, everybody uses it. But it's GPL, thus incompatible with ROOT's LGPL and cling's MIT/XFree-like license, and those are our use cases. And readline doesn't work on Windows.

Of course there must be a prompt text input library that works on all platforms, and that's compatible with MIT/XFree. After searching again and again I gave up: I believe it really does not exist. So why not just write our own? If nobody has it, maybe other people would like to have it, too?

What would be the requirements? Linux, MacOS, Solaris, Windows (and all the other ROOT supported platforms), no ncurses (hey, with only a handful terminals left, [n]curses is really overkill - think of "set baud rate". And it's huge), and why not allow for multiple input and output paths (think: GUI), hooks for function keys, and fix issues we found with editline?

The result is the C++ TextInput library. It's used in ROOT since v5.30(-RC1). It has the same MIT/XFree compatible license as llvm and cling. If you want to use it for your own program, get it through subversion from svn co http://root.cern.ch/svn/root/trunk/core/textinput/src/textinput. It still has bugs, but they are getting less. If you find any, please let me know!

This means ROOT v5.30 will feature (now even on Windows) editing across wrapping lines (remember the continuation '$' when you typed more than 80 characters?) and colors. Enjoy!

Cheers,
 

Comments

OMG. Fantastic! I can't wait for the multiline input. I've done whole physics analyses with ntuple->Draw(...) and the command sometimes gets pretty long, even after a lot of ntuple->SetAlias(...) calls to define all the cuts. :)

Hi Andy,

Thanks! Yes, first thing I always did was increase the width of cmd.exe (in properties) to get some extra characters :-) Well the best part is of course: you don't have to wait! Just download the RC.

Cheers, Axel.