[net.bugs.4bsd] Bug_in_vi_map_funtion

lab@qubix.UUCP (06/07/83)

I have found a VERY annoying bug in the map! capability of vi.
Background:
	map! ^[ ^[l
	map! ^[I ^D
The former causes the cursor to stay in the same place when ESC
has been pressed (rather than backing up one to the left). The
latter is my BackTab key, which I am using in input mode to
backtab over autoindent.

Bug: when I press BackTab, vi sees the ^[ and maps it, without
seeing if any other keystrokes arrive within 1 second (p. 16 of vi
documentation). This gives me ^[lI, effectively moving the cursor
all the way left, rather than one tab position, and leaving me in
input mode (with a beep from l (move right) at the end of a line).

If I unmap ^[, there is no problem with ^[I. If I map a starting
substring of any of my other function keys in command mode, there
is no problem.
					Larry Bickford
					decvax!decwrl!qubix!lab

chris@umcp-cs.UUCP (06/09/83)

Speaking of VI map bugs, here's a cute bug that's very similar.  Type

	:ab bar bar-bell

then  (in  insert  mode)  type 'bar'.  Wheee!  Lots of fun, if you like
watching the cursor move.  Now hit DEL.  Gosh!   Where  did  all  those
'bell's come from?  (The latter doesn't always happen, and when it does
you usually get some strange control character too).  I ran  into  this
bug  once  when  I tried to abbreviate someone's first name to his full
name, or some such.

Vi  should  notice  that  it's expanding the abbreviation and refuse to
expand it again, so that it won't endless  loop.    It  would  even  be
acceptable  to  stop  expanding  ALL abbreviations, as long as it stops
expanding the initial one.