1

Why can't I use the left and right arrow keys (actually, the same goes for the up and down keys as well) to move about the line I'm currently on in the tclsh interactive shell? If I try to press either one, I get a bunch of abracadabra instead of moving back and forth. This is not all that convenient when, for example, you make a typo, but you can't move the cursor back to change it. You have to use the backspace key to erase all the stuff that you've typed after the place where the typo is located thereby destroying all your work. Is it possible to fix this, quite frankly, buggy behaviour?

enter image description here

misha
  • 952

1 Answers1

5

This functionality appears to be provided by the tcl-tclreadline package. From apt-cache show tcl-tclreadline:

Description-en_CA: GNU Readline Extension for Tcl/Tk
 tclreadline adds GNU Readline support to standard Tcl/Tk.  It provides
 interactive command editing and history for Tcl shells (this must be
 enabled on a user-by-user basis) and allows the use of GNU Readline
 features in Tcl programs.

Once you have installed the package, either from the Software Center or via the command line using sudo apt-get install tcl-tclreadline, you can enable it for interactive tcl shells by adding

if {$tcl_interactive} {
  package require tclreadline 
  ::tclreadline::Loop
}

to your $HOME/.tclshrc file as explained on the tclreadline project homepage.

steeldriver
  • 136,215
  • 21
  • 243
  • 336