Subject: Re: ^W killed my line
To: NetBSD-current Discussion List <firstname.lastname@example.org>
From: Greg A. Woods <email@example.com>
Date: 02/29/2000 15:50:19
[ On Tuesday, February 29, 2000 at 13:41:27 (+0100), Olaf Seibert wrote: ]
> Subject: Re: ^W killed my line
> On Tue 29 Feb 2000 at 00:27:53 -0500, Greg A. Woods wrote:
> > I think you're hung up on the idea that the tty driver should be the one
> > and only king of input editing.
> Exactly. That's what the tty driver is for. To provide a consistent way
> to input one's text to programs (and correct it).
That's nice in theory, but this is Unix, not AmigaOS, and the tty
driver's real job is to do the I/O, not to do input editing. In Unix
the application does the editing and the commonality and consistency is
achieved by using the same code in every application (eg. in this case
linking against libedit).
Yes the Unix tty driver has always had some basic editing skills, though
usually restricted to just erasing the most recently typed character and
killing the entire input line. The additional features of killing the
previous word, redrawing the line, stopping erase drawing at the
beginning of the current input, etc., were all added by the "newcrt"
line discipline sometime in the early 4BSD days (or maybe even slightly
before). Someone at that time even experimented with putting an output
"pager" in the tty driver, but thankfully that was removed before it
spread too far.... These features never made it into Research Unix and
were not in any other major AT&T Unix release until SysVr4.
In any case if an application wants to do character editing in Unix it
must turn off canonical input processing in the tty driver. This means
that any such application would have to look at the current tty settings
in order to mimic them, but that this would obviously only make sense to
do if it fit into the UI paradigm the application presents. Perhaps it
might make sense for an input editor in "vi" mode, but it certainly does
not make sense to do in an input editor mimicing "emacs".
I'd recommend that anyone interested in this heritage of Unix look not
only at some of the older papers on the subject, but also look at the
way Plan 9 approached this stuff too.
Greg A. Woods
+1 416 218-0098 VE3TCP <firstname.lastname@example.org> <robohack!woods>
Planix, Inc. <email@example.com>; Secrets of the Weird <firstname.lastname@example.org>