为什么我不能使用向左和向右箭头键(实际上,向上和向下键也是如此)在tclsh
交互式 shell 中移动当前所在的行?如果我尝试按其中任何一个,我就会得到一堆咒语,而不是来回移动。例如,当您输入错误,但又无法将光标移回以更改它时,这并不是那么方便。您必须使用退格键删除您在拼写错误所在位置之后输入的所有内容,从而破坏您的所有工作。坦率地说,有可能解决这个错误行为吗?
该功能似乎是由该tcl-tclreadline
包提供的。从apt-cache show tcl-tclreadline
:
Run Code Online (Sandbox Code Playgroud)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.
安装该软件包后,无论是从软件中心还是通过命令行使用sudo apt-get install tcl-tclreadline
,您都可以通过添加以下命令来启用它以用于交互式 tcl shell
if {$tcl_interactive} {
package require tclreadline
::tclreadline::Loop
}
Run Code Online (Sandbox Code Playgroud)
按照tclreadline 项目主页上的说明添加到您的$HOME/.tclshrc
文件中。