kern/152162: [syscons] On syscons, pressing delete key results in pressing backspace.

Jilles Tjoelker jilles at
Fri Dec 3 13:51:36 UTC 2010

On Mon, Nov 29, 2010 at 04:36:31PM +1100, Bruce Evans wrote:
> On Sun, 21 Nov 2010, Jilles Tjoelker wrote:
> > With the new "libteken" terminal emulator code in 9-current, syscons is
> > now much like xterm. It appears that Backspace is still ^H, but Delete
> > is now ^[[3~ instead of ^?.

> That is a bug, but libteken in syscons mode doesn't have it.  Termios
> only supports single characters as special characters, so mapping any
> key to multiple characters breaks its use as a special character for
> normal POSIX terminal input.  Loss of the special character ASCII DEL
> would be especially large breakage since it is in common use as a special
> character.  Some key should be mapped to it, and the old choice of the
> Delete key is best.  Perhaps termios can support wide characters or
> encoded characters for termios (cc_t can be any integral type), but
> I've never seen that done, and cc_t is just unsigned char in FreeBSD.

I do not consider losing the ability to use Delete as a termios control
character a big loss, as there is no obvious thing to use it for. The
keys Insert, Home, End, Page Up and Page Down cannot be used in this way
either. The key labelled <-- and/or Backspace should be VERASE, and that
is possible because it is and remains a single byte (either ^H or ^?).

libteken in xterm mode allows ctrl+backspace for ^?, in case you need it
for some reason.

> > A while ago, I changed 9-current libedit (and therefore programs like sh
> > and ftp) to recognize ^[[3~. I encourage you to ask tcsh upstream to fix
> > this as well (either by hardcoding ^[[3~ somewhere or by using the
> > appropriate termcap/terminfo field).

> Editors not using normal terminal input can do this.  Some intentionally
> put the keyboard in a special mode in which the keys return longer, unique
> escape sequences so that they be reassigned.  I couldn't find the standard
> termcap variable for this, but found the interesting variables S4 and S5
> which switch between normal keyboard mode and "PC scancode mode" for SVr4
> on PCs.

Please, no additional keyboard modes. They cause annoyance and confusion
if they are set incorrectly for some reason.

> > Making the Backspace key send ^? may be slightly dangerous as it is
> > rather annoying if Backspace does Delete (more annoying than Delete
> > doing Backspace, IMHO). On the other hand, vte-based terminal programs
> > such as gnome-terminal and xfce4's Terminal send ^? by default and it
> > seems to work fine.

> ASCII DEL is still the default for VERASE.  Anyone still using that
> would expect Delete to work as Backspace and be very annoyed if Delete
> started returning CSI 3 ~.  IIRC, the first U[^H|^?]Xenix system that
> I used had this (DEL for VERASE), and perhaps also ASCII Backspace for
> VINTR.  Or it may just have had DEL for VINTR.  Certainly not the ^C
> for VINTR that I was used to.  This took some getting used to.  After
> a while I learned to use stty to map Backspace and ^C "normally" and
> now rarely use Delete/DEL.

Some old Unices used ^?/Delete as interrupt character, but I think it is
OK if people who want this need to reconfigure their keyboard mappings,
possibly breaking other things. All recent systems use ^C for interrupt
and Delete's function of deleting to the right of the cursor is more

Jilles Tjoelker

More information about the freebsd-bugs mailing list