readline

The GNU Readline provides a set of functions for use by applications that allow users to edit command lines as they are typed in. Most of the work in the readline library is done by the readline function.

See tclreadline for the Tcl bindings.