If you type }
after {
, )
after (
or ]
after [
in CLISP (and I'm sure many more) terminal, the corresponding opening bracket gets highlighted for about a second, before returning to normal state.
如果在[,CLISP之后(或我确定更多)终端之后(或)之后键入},则在返回正常状态之前,相应的左括号会突出显示大约一秒钟。
How can I get this behavior, at least when doing gets
in Ruby, cin
in C++ and scanf
in C?
我怎么能得到这种行为,至少在使用Ruby时,cin用C ++和scanf用C?
1 个解决方案
#1
0
To control things like cursor position, text formatting and so on, you have to talk directly to the terminal, in a way which is not accessible through the stream interfaces of cin
of scanf
. Not sure about Ruby, but I'd guess the same applies there as well. On POSIX systems, this control is achieved via a set of I/O controls (ioctl
), which provide an out-of-band communication with the terminal device. There are libraries which provide some degree of portability when talking to a terminal. The most commonly used is probably ncurses, which was already mentioned by David Rodríguez.
要控制光标位置,文本格式等内容,必须直接与终端通信,这种方式无法通过scanf的cin流接口访问。不确定Ruby,但我猜这同样适用。在POSIX系统上,该控制是通过一组I / O控制(ioctl)实现的,它们提供与终端设备的带外通信。有些库在与终端通信时提供一定程度的便携性。最常用的可能是ncurses,DavidRodríguez已经提到了这一点。
#1
0
To control things like cursor position, text formatting and so on, you have to talk directly to the terminal, in a way which is not accessible through the stream interfaces of cin
of scanf
. Not sure about Ruby, but I'd guess the same applies there as well. On POSIX systems, this control is achieved via a set of I/O controls (ioctl
), which provide an out-of-band communication with the terminal device. There are libraries which provide some degree of portability when talking to a terminal. The most commonly used is probably ncurses, which was already mentioned by David Rodríguez.
要控制光标位置,文本格式等内容,必须直接与终端通信,这种方式无法通过scanf的cin流接口访问。不确定Ruby,但我猜这同样适用。在POSIX系统上,该控制是通过一组I / O控制(ioctl)实现的,它们提供与终端设备的带外通信。有些库在与终端通信时提供一定程度的便携性。最常用的可能是ncurses,DavidRodríguez已经提到了这一点。