EscTimeoutInVi

HomePage | RecentChanges | EditorIndex | TextEditorFamilies | Preferences

Showing revision 8
The most annoying problem with implementing a modal editor for a modern keyboard is that the escapec key is used twice: as the key to enter command mode and as the start of an escape sequence like an arrow key would typically send.

The result of this is that to implement a responsive vi-like editor you need to set a timeout before you decide the user just pressed escape and not a arrow key. This timeout will always fail under certain circumstances !

Of course one could wait with evaluating the escape till the next character is known but this will feel very bad to the user because the editor doesn't seem to respond at first.

So maybe vi should have had an other key for command mode, or keyboard designers should have taken another control char for their sequences instead of the escape (which is control-[ itself), but that's history :(


Well, part of the problem is that we use VI like editors in terminal emulators that are simulating a computing environment that is now 30+ years old where ESC [ A and ESC [ 7 0 m mean things! Thus, there has to be a bit of a delay to determine if the escape was a single keystroke or part of a compound key. Since VI actually uses ESC for a purpose, it causes problems.

Note that emacs has a similar problem with CTRL-S and CTRL-Q, which are normally used for flow-control on serial lines. Today, that's quite unnecessary since flow control is done through hardware. However, I'm always surprised at how many systems still use XonXoff? flow control. -- RonPerrella


HomePage | RecentChanges | EditorIndex | TextEditorFamilies | Preferences
Edit revision 8 of this page | View other revisions | View current revision
Edited March 22, 2005 10:16 am (diff)
Search: