[4957] in testers

home help back first fref pref prev next nref lref last post

nvi and arrow keys on Linux

daemon@ATHENA.MIT.EDU (Mitchell E Berger)
Sun Jul 8 06:22:35 2001

Message-Id: <200107081022.GAA03023@gorf.mit.edu>
To: testers@MIT.EDU
cc: sly@MIT.EDU
Date: Sun, 08 Jul 2001 06:22:31 -0400
From: Mitchell E Berger <mitchb@MIT.EDU>

It was recently noted over zephyr that the arrow keys failed to work in vi
on Linux.  However, they did work on Solaris and SGI, and on all the platforms
in 8.4.  vi on Linux is really nvi.  Greg mentioned that a change had been
made to the way we compiled it recently, and that this could be related.

I've looked at the repository, and we used to use the native Linux libcurses
when building nvi (configure was given the --disable-curses flag to disable
its bundled curses), now we use the bundled curses.  The reason for the change
is that sometimes upon exit the prompt and cursor would appear too high on the
screen, potentially on top of other text.

I've built the nvi package as is and with --disable-curses.  The normal build
exhibits the broken arrow key behavior, while the --disable-curses one works
with the arrow keys, so this is definitely the change that caused arrows to
break.  That would lead to the conclusion that nvi's bundled curses is broken
(which would be funny because its README explains how most other versions of
libcurses are broken, so you should probably use theirs).  However, I downloaded
their current distribution (which is the same version in the release), verified
that it exhibited the same behaviors on Linux (it did), then built it using
the bundled curses on Solaris and IRIX... the arrow keys worked on both!  So,
there's something more subtle wrong here.

Further web searches have failed to be helpful, so I'm about at the end of how
much I can debug this, but what it boils down to is that we've corrected a
nuisance of a bug (the exit behavior) which didn't actually cause errors (using
the prompt on an already printed on screen worked, plus you could clear the
screen and everything would be fine), and in the process we've broken a
previously working feature (nvi's man page explicitly says arrow keys are
supposed to work, and they don't fail silently - you get a rather annoying error
message and beep) that many vi users will notice.

We could:
- Leave arrow keys broken
- Revert the change and have sometimes wierd exit behavior
- Replace it with vim or something else (why do we use nvi?)
- Revert the change and alter the code to change its exit behavior (ick)
- Something else I haven't thought of

Thoughts?

Mitch

home help back first fref pref prev next nref lref last post