tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: wsvt25 backspace key should match terminfo definition



On Tue, Nov 23, 2021 at 09:22:43 -0500, Greg Troxel wrote:

> Valery Ushakov <uwe%stderr.spb.ru@localhost> writes:
> 
> > On Tue, Nov 23, 2021 at 00:01:40 +0000, RVP wrote:
> >
> >> On Tue, 23 Nov 2021, Johnny Billquist wrote:
> >> 
> >> > If something pretends to be a VT220, then the key that deletes
> >> > characters to the left should send DEL, not BS...
> >> > Just saying...
> >> 
> >> That's fine with me too. As long as things are consistent. I suggested the
> >> kernel change because both terminfo definitions (and the FreeBSD console)
> >> go for ^H.
> >
> > Note that the pckbd_keydesc_us keymap maps the scancode of the <- key to
> >
> >     KC(14),  KS_Cmd_ResetEmul, KS_Delete,
> >
> > i.e. 0x7f (^?).
> >
> > terminfo is obviously incorrect here.  Amazingly, the bug is actually
> > in vt220 description!  wsvt25 just inherits from it:
> >
> > $ infocmp -1 vt220 | grep kbs
> >         kbs=^H,
> >
> > I checkeed termcap.src from netbsd-4 and it's wrong there too.  I have
> > no idea htf that could have happened.
> 
> I think (memory is getting fuzzy) the problem is that the old terminals
> had a delete key, in the upper right, that users use to remove the
> previous character, and a BS key, upper left, that was actually a
> carriage control character.
[... snip ...]
> I see the same kbs=^H on vt52.

vt52 is different.  I never used a real vt52 or a clone, but the
manual at vt100.net gives the following picture:

  https://vt100.net/docs/vt52-mm/figure3-1.html

and the description

  https://vt100.net/docs/vt52-mm/chapter3.html#S3.1.2.3

  Key		Code	Action Taken if Codes Are Echoed
  BACK SPACE	010	Backspace (Cursor Left) function
  DELETE 	177 	Nothing


vt100 had similar keyboard (again, never used a real one personally)

  https://vt100.net/docs/vt100-ug/chapter3.html#F3-2

  BACKSPACE	010	Backspace function
  DELETE 	177 	Ignored by the VT100


But vt200 and later use a different keyboard, lk201 (and i did use a
real vt220 a lot)

  https://vt100.net/docs/vt220-rm/figure3-1.html

that picture is not very good, the one from the vt320 manual is better

  https://vt100.net/docs/vt320-uu/chapter3.html

vt220 does NOT have a configuration option that selects the code that
the <X] key at the upper right corner sends.  It's always ^? (\177).

But somehow the official terminfo database has kbs=^H for vt220!


Later it became configurable:

  https://vt100.net/docs/vt320-uu/chapter4.html#S4.13

For vt320 (where it *is* configurable) terminfo has

  $ infocmp -1 vt320 | grep kbs
          kbs=^?,


> I think the first thing to answer is "what is kbs in terminfo supposed
> to mean".

X/Open Curses, Issue 7 doesn't explain, other than saying "backspace"
key, which is an unfortunate name, as it's loaded.  But it's
sufficiently clear from the context that it's the key that deletes
backwards, i.e. <X] or <-, as opposed to "delete" key (kdch1) that
deletes under.


> My other question is how kbs is used from terminfo.  Is it about
> generating output sequences to move the active cursor one left?  If so,
> it's right.  Is it about "what should the user type to delete left",
> then for a vt52/vt220, that's wrong.  If it is supposed to be both,
> that's an architectural bug as those aren't the same thing.

No, k* capabilities are sequences generated by the terminal when some
key is pressed.  The capability for the sequence sent to the the
terminal to move the cursor left one position is cub1

  $ infocmp -1 vt220 | grep cub1
          cub1=^H,
          kcub1=\E[D,

(kcub1 is the sequence generated by the left arrow _k_ey).


-uwe


Home | Main Index | Thread Index | Old Index