Markus Kuhn wrote:

> > From terminal to application there is a problem: The ESC could be typed or
> > could be the start of an escape sequence.  This is especially a problem
> > for Vi, because ESC is used to get out of Insert mode.  The difference
> > between a typed ESC and the start of an escape sequence can only be
> > guessed by using a timeout.
> 
> It is an obvious bug in modern versions of vi that the keystroke
> sequences that it parses do not form a prefix code. The original vi
> didn't care about function keys (such as cursor controls) and therefore
> didn't have this bug. Extended versions of vi should have abandoned ESC
> as the insert mode terminator in favour of some other mechanism (for
> instance Ctrl-X (CAN) would seem fully appropriate and is easy to enter).

That's bull shit.  You can't change such an essential part of the user
interface.  You would create a new editor.  And for most people ESC is easier
and quicker to enter than CTRL-X, because it requires using only one finger.

Anyway, the ESC key is used in many applications, it's on the keyboard, it's
there to be used.  The real problem is that escape sequences shouldn't start
with a code that is also used for a key on the keyboard.

> ESC is *not* just another function key. It is a key that was intended to
> allow users to enter arbitrary function key sequences.

Where did you get that idea?  It's just another key, to be used for whatever
the application writer wants to use it.  The only rule there is for how to use
keys is that it should do what the user expects.  No standard can overrule
that.

I don't think we have to take into account what this key was meant to be used
for 20 years ago when it first appeared.  Now it's mostly used as a "get out"
or "cancel" key.  And it works well that way.

> May be, ESC could be turned into a proper function key as Ctrl-[ is
> still available to serve for hand-generating arbitrary ESC sequences.
> 
> The other option is of course to start all function key sequences with
> CSI instead of ESC [.

Yep, that is a good solution.  Many applications already do this, but
unfortunately the termcap/terminfo mechanism isn't setup to handle this
alternate form of escape sequences.  Therefore it is hardly ever used.
For example, you can put an xterm into 8bit mode, but the CSI sequences it
sends then are not in ther termcap/terminfo entry.  I specifically added code
to xterm to handle this (OPT_TCAP_QUERY).

> I guess both solutions bring the usual bag of backwards compatibility
> problems with them, but if we end up writing a simplified concise new
> text terminal standard some day, we definitely should take these options
> into consideration.

The escape sequences that a terminal uses are stored in termcap/terminfo
entry.  This means you can change them completely if you use another name for
the terminal.  For example, if you would create a linux console that uses CSI
instead of ESC, you can give it the name "linixcsi" and add an
termcap/terminfo entry and all applications will work just fine.

On the other hand, if you would change the code that the ESC key sends,
applications that use this key will stop working.  There is no
termcap/terminfo entry for the code that the ESC key sends, since it's always
ESC (0x1b).

> Vi's usage model (with insert modes and the need to get out of them,
> etc.) is anyway horribly outdated. It has been my (understandable)
> experience that beginners simply hate vi.

A great oppurtunity to start a war on this! :-)

Seriously, experienced users can work much faster with the difference between
Insert and Command mode.  It has many advantages once you have learned to use
it.  Of course, the price to pay is the learning time.  It pays back later.

Beginners hate everything they need to learn, and later hate everything that
requires typing meta- alt- control- keys and get RSI problems because of using
the mouse.  There is no perfect solution.

> Encouraging students in a Unix
> beginners class to get used to vi is the main reason why Unix get's such
> an arcane flavour associated with it for young students. Olttimers like
> myself (I just turned 30 ;-) use vi primarily because it is for strange
> historic reasons more widely installed than more modern alternatives
> such as pico, joe, mined et al. that are permanently in insert mode. The
> only other editor old enough to be ubiquitously installed is Emacs, but
> people don't use it universally because of its huge resource
> requirements and the fact that it requires >> 200 ms to start it as a
> new process.

My experience is that people use Vi (or Vim) because they got tired of those
easy to use editors, and finally took the time to learn to use a editor that
gives them better control and allows them to work effectively.

If you don't have time to learn an editor, use notepad or an equivalent.
Then you can start right away but work slowly.  Or you learn to use an editor
like Vim.  Then you need to invest time to learn it, and you end up working
very fast.

Anyway, Vim can also be used in Insert mode like those other editors.  You can
use the mouse, cursor keys, etc.  I know one teacher that provides his
students with Vim setup to stay in insert mode (that's one option setting).
They don't notice the difference.

> I would have loved to see POSIX.2 standardize another editor than vi,
> but they failed to do that.

They didn't standardize vi very well either.  It's near to impossible to
standardize a larger application that's user-interface oriented.

-- 
If your life is a hard drive,
Christ can be your backup.

 ///  Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.moolenaar.net  \\\
(((   Creator of Vim - http://www.vim.org -- ftp://ftp.vim.org/pub/vim   )))
 \\\  Help me helping AIDS orphans in Uganda - http://iccf-holland.org  ///
-
Linux-UTF8:   i18n of Linux on all levels
Archive:      http://mail.nl.linux.org/lists/

Reply via email to