Differences between "our" terminfo and ncurses' #670

Closed
opened 3 months ago by dnkl · 7 comments
dnkl commented 3 months ago
Owner

The next release of ncurses will ship a version of foot's terminfo. Below are the comments from ncurses terminfo source file, and a diff between "our" version and ncurses'.

# https://codeberg.org/dnkl/foot/
# Version 1.8.2
#
# This identifies as a VT220 with 4=sixel and 22=color, however:
# tack:
#       bell does not work

It does, but is disabled by default. I.e. it needs to be configured.

#       status-line does not work because foot does not set the window title

It does, but I'm guessing he tested foot with CSDs (probably on Weston or GNOME), where versions through 1.8.2 doesn't render the title. Title has always worked with SSDs, and starting with foot 1.8.3, we'll also render the title on CSDs.

#       sends escape when meta key is used, whether or not smm/rmm enabled

our smm/rmm only toggles private mode 1034. To instead have meta set the 8:th bit you also need to disable private mode 1036. I'll double check xterm's behavior.

# vttest:
#       wrap-test fails

This is due to bw.

#       no application-mode for numeric keypad (unless private mode 1035 is set)
#       no NRCS
#       no VT52
#       no SRM
#       protected areas do not work
#       SU/SD work, SL/SR do not
#       DECRPM responds, but not the c>orresponding ANSI reports.
#       otherwise few reports, except cursor-position and mouse and some dtterm
#       VT520 cursor-movement works, except for left/right margins

All correct, AFAIK.

#       supports xterm/DECSCUSR, though default case in vttest does not blink
#               Send: <27> [ 0 <32> q
#               Text: The cursor should be a blinking rectangle

This was an intentional design decision. 0q reverts to the configured (i.e. foot.ini) mode. One can use 1q for blinking block, or 2q for steady block.

#       partial support for xterm mouse any-event mode and button-event mode:
#       + does not report focus-in/focus-out
#       + does not report buttons 6/7

Support for button 6/7 is #666.

I'm very curious about the focus-in/out issue. As far as I can tell, it is working. Tested on Weston, GNOME, KDE, Sway and river.

Diff (ncurses to the left, our to the right):

comparing foot2 to foot.
    comparing booleans.
	km: F:T.
	Tc: F:T.
    comparing numbers.
    comparing strings.
	dsl: NULL, '\E]2;\E\\'.
	fsl: NULL, '\E\\'.
	ich1: '\E[@', NULL.
	ka1: NULL, '\EOw'.
	ka3: NULL, '\EOy'.
	kb2: NULL, '\EOu'.
	kc1: NULL, '\EOq'.
	kc3: NULL, '\EOs'.
	kent: NULL, '\EOM'.
	kmous: '\E[<', '\E[M'.
	rmm: NULL, '\E[?1034l'.
	smm: NULL, '\E[?1034h'.
	tsl: NULL, '\E]2;'.
	Sync: NULL, '\EP=%p1%ds\E\\'.
	XM: '\E[?1006;1000%?%p1%{1}%=%th%el%;', NULL.
	ka2: NULL, '\EOx'.
	kb1: NULL, '\EOt'.
	kb3: NULL, '\EOv'.
	kc2: NULL, '\EOr'.
	kp5: NULL, '\EOE'.
	kpADD: NULL, '\EOk'.
	kpCMA: NULL, '\EOl'.
	kpDIV: NULL, '\EOo'.
	kpDOT: NULL, '\EOn'.
	kpMUL: NULL, '\EOj'.
	kpSUB: NULL, '\EOm'.
	kpZRO: NULL, '\EOp'.
	setrgbb: NULL, '\E[48\:2\:\:%p1%d\:%p2%d\:%p3%dm'.
	setrgbf: NULL, '\E[38\:2\:\:%p1%d\:%p2%d\:%p3%dm'.
	xm: '\E[<%i%p3%d;%p1%d;%p2%d;%?%p4%tM%em%;', NULL.
  • ich1 is #668
  • kmous, xm and XM is #669
  • dsl/fsl/tsl have been disabled by Dickey since he believes foot doesn't set the window title.
  • rmm/smm/km probably disabled due to the meta 8:th bit confusion.
  • k* (key capabilities): probably disabled since foot, by default doesn't enable application mode (you need to disable private mode 1035). This may very well be the correct thing to do.
  • Tc/Sync/setrgbb/setrgbf: these are non-standard capabilities and aren't (yet) included in any ncurses terminfos. This is the biggest reason I want to keep our own terminfo.

Once I've gone through all this in detail, and verified foot's behavior with xterm, I'll contact Dickey.

The next release of ncurses will ship a version of foot's terminfo. Below are the comments from ncurses terminfo source file, and a diff between "our" version and ncurses'. > ``` > # https://codeberg.org/dnkl/foot/ > # Version 1.8.2 > # > # This identifies as a VT220 with 4=sixel and 22=color, however: > # tack: > # bell does not work > ``` It does, but is disabled by default. I.e. it needs to be configured. > ``` > # status-line does not work because foot does not set the window title > ``` It does, but I'm guessing he tested foot with CSDs (probably on Weston or GNOME), where versions through 1.8.2 doesn't render the title. Title has always worked with SSDs, and starting with foot 1.8.3, we'll also render the title on CSDs. > ``` > # sends escape when meta key is used, whether or not smm/rmm enabled > ``` our smm/rmm only toggles private mode 1034. To instead have meta set the 8:th bit you also need to disable private mode 1036. I'll double check xterm's behavior. > ``` > # vttest: > # wrap-test fails > ``` This is due to `bw`. > ``` > # no application-mode for numeric keypad (unless private mode 1035 is set) > # no NRCS > # no VT52 > # no SRM > # protected areas do not work > # SU/SD work, SL/SR do not > # DECRPM responds, but not the c>orresponding ANSI reports. > # otherwise few reports, except cursor-position and mouse and some dtterm > # VT520 cursor-movement works, except for left/right margins > ``` All correct, AFAIK. > ``` > # supports xterm/DECSCUSR, though default case in vttest does not blink > # Send: <27> [ 0 <32> q > # Text: The cursor should be a blinking rectangle > ``` This was an intentional design decision. `0q` reverts to the configured (i.e. `foot.ini`) mode. One can use `1q` for blinking block, or `2q` for steady block. > ``` > # partial support for xterm mouse any-event mode and button-event mode: > # + does not report focus-in/focus-out > # + does not report buttons 6/7 > ``` Support for button 6/7 is https://codeberg.org/dnkl/foot/pulls/666. I'm very curious about the focus-in/out issue. As far as I can tell, it _is_ working. Tested on Weston, GNOME, KDE, Sway and river. Diff (ncurses to the left, our to the right): ``` comparing foot2 to foot. comparing booleans. km: F:T. Tc: F:T. comparing numbers. comparing strings. dsl: NULL, '\E]2;\E\\'. fsl: NULL, '\E\\'. ich1: '\E[@', NULL. ka1: NULL, '\EOw'. ka3: NULL, '\EOy'. kb2: NULL, '\EOu'. kc1: NULL, '\EOq'. kc3: NULL, '\EOs'. kent: NULL, '\EOM'. kmous: '\E[<', '\E[M'. rmm: NULL, '\E[?1034l'. smm: NULL, '\E[?1034h'. tsl: NULL, '\E]2;'. Sync: NULL, '\EP=%p1%ds\E\\'. XM: '\E[?1006;1000%?%p1%{1}%=%th%el%;', NULL. ka2: NULL, '\EOx'. kb1: NULL, '\EOt'. kb3: NULL, '\EOv'. kc2: NULL, '\EOr'. kp5: NULL, '\EOE'. kpADD: NULL, '\EOk'. kpCMA: NULL, '\EOl'. kpDIV: NULL, '\EOo'. kpDOT: NULL, '\EOn'. kpMUL: NULL, '\EOj'. kpSUB: NULL, '\EOm'. kpZRO: NULL, '\EOp'. setrgbb: NULL, '\E[48\:2\:\:%p1%d\:%p2%d\:%p3%dm'. setrgbf: NULL, '\E[38\:2\:\:%p1%d\:%p2%d\:%p3%dm'. xm: '\E[<%i%p3%d;%p1%d;%p2%d;%?%p4%tM%em%;', NULL. ``` * `ich1` is https://codeberg.org/dnkl/foot/pulls/668 * `kmous`, `xm` and `XM` is https://codeberg.org/dnkl/foot/pulls/669 * `dsl`/`fsl`/`tsl` have been disabled by Dickey since he believes foot doesn't set the window title. * `rmm`/`smm`/`km` probably disabled due to the meta 8:th bit confusion. * `k*` (key capabilities): probably disabled since foot, by **default** doesn't enable application mode (you need to disable private mode 1035). This may very well be the correct thing to do. * `Tc`/`Sync`/`setrgbb`/`setrgbf`: these are non-standard capabilities and aren't (yet) included in _any_ ncurses terminfos. This is the biggest reason I want to keep our own terminfo. Once I've gone through all this in detail, and verified foot's behavior with xterm, I'll contact Dickey.
Poster
Owner

our smm/rmm only toggles private mode 1034. To instead have meta set the 8:th bit you also need to disable private mode 1036. I'll double check xterm's behavior.

As far as I can tell, we match XTerm's behavior, except we default to 1036 set, while in XTerm it's disabled by default.

Given that, it might make sense the terminfo doesn't have km/rmm/smm, as it doesn't reflect the terminal's default behavior.

> our smm/rmm only toggles private mode 1034. To instead have meta set the 8:th bit you also need to disable private mode 1036. I'll double check xterm's behavior. As far as I can tell, we match XTerm's behavior, _except_ we default to 1036 **set**, while in XTerm it's disabled by default. Given that, it might make sense the terminfo doesn't have `km`/`rmm`/`smm`, as it doesn't reflect the terminal's default behavior.
Collaborator

The terminfo(5) description of km/rmm/smm is:

If the terminal has a “meta key” which acts as a shift key, setting the 8th bit of any character transmitted, this fact can be indicated with km. Otherwise, software will assume that the 8th bit is parity and it will usually be cleared. If strings exist to turn this “meta mode” on and off, they can be given as smm and rmm.

I'd like to be able to draw some sensible conclusion from that, but it's so ambiguous and steeped in legacy garbage that I'm not really sure how to interpret it. Obviously foot doesn't set the 8th bit by default, but then again would omitting km imply that there's no meta key whatsoever?

It'd probably make no difference either way for ncurses apps, but I wonder what kind of thing terminfo apps might infer from km being absent? I guess it's probably just a matter of deciding whether to emit smm/rmm at startup/shutdown, in which case omitting all 3 capabilities is probably the correct thing to do.

The `terminfo`(5) description of `km`/`rmm`/`smm` is: > If the terminal has a “meta key” which acts as a shift key, setting the 8th bit of any character transmitted, this fact can be indicated with `km`. Otherwise, software will assume that the 8th bit is parity and it will usually be cleared. If strings exist to turn this “meta mode” on and off, they can be given as `smm` and `rmm`. I'd like to be able to draw some sensible conclusion from that, but it's so ambiguous and steeped in legacy garbage that I'm not really sure how to interpret it. Obviously foot doesn't set the 8th bit by default, but then again would omitting `km` imply that there's no meta key whatsoever? It'd probably make no difference either way for ncurses apps, but I wonder what kind of thing terminfo apps might infer from `km` being absent? I guess it's probably just a matter of deciding whether to emit `smm`/`rmm` at startup/shutdown, in which case omitting all 3 capabilities is probably the correct thing to do.
Poster
Owner

A lot of applications more or less assume meta/alt sends EXC, don't they? But what are ncurses applications doing? They recognize both 8-bit meta escapes, and ESC prefixed ones?

A lot of applications more or less assume meta/alt sends EXC, don't they? But what are ncurses applications doing? They recognize both 8-bit meta escapes, _and_ ESC prefixed ones?
Collaborator

A lot of applications more or less assume meta/alt sends EXC, don't they?

Yeah, I think most non-curses apps just opt to recognize an ESC prefix as meta and ignore the 8th bit = meta stuff altogether.

But what are ncurses applications doing?

According to the TO-DO file in ncurses, km (has_meta_key) isn't used at all by ncurses itself.

The smm and rmm capabilities are sent when meta(3) is called, but as far as I can tell (from reading the man page and grepping the sources), their presence or absence doesn't make any difference to anything else.

So I'd say it's probably safe to just remove them.

> A lot of applications more or less assume meta/alt sends EXC, don't they? Yeah, I think most non-curses apps just opt to recognize an ESC prefix as meta and ignore the 8th bit = meta stuff altogether. > But what are ncurses applications doing? According to the [`TO-DO`] file in ncurses, `km` (`has_meta_key`) isn't used at all by ncurses itself. The `smm` and `rmm` capabilities are sent when `meta(3)` is called, but as far as I can tell (from reading the man page and grepping the sources), their presence or absence doesn't make any difference to anything else. So I'd say it's probably safe to just remove them. [`TO-DO`]: https://github.com/ThomasDickey/ncurses-snapshots/blob/master/TO-DO#L196
Poster
Owner
Issues and questions reported upstream: https://lists.gnu.org/archive/html/bug-ncurses/2021-08/msg00008.html
Poster
Owner

Reply (I'm not including the full reply here, just the things I consider are worth commenting).

(dickey's reply in the outermost quotes)

# tack:
#       bell does not work

It does, but is disabled by default. I’m not going to bore you with the
details of how to configure it, but if you wanted it to play a bell sound,
regardless of whether the window is focused or not, you would add something
like this (to ~/.config/foot/foot.ini):

If it's disabled, it doesn't belong in the terminal description.

(a terminal description is a collection of features for a particular
configuration, including commonly-used features such as cursor-visibility
that can be altered using -- you guessed it -- the terminal description)

and

#       sends escape when meta key is used, whether or not smm/rmm
enabled

Correct, but note that this is because foot has private mode 1036 enabled by
default. Assuming it would be a bad idea to include 1036 in smm/rmm, I agree
that removing km/smm/rmm better reflects foot’s default behavior.

again, disabled by default makes it not part of the terminal description

and

	ka1: NULL, '\EOw'.
	ka3: NULL, '\EOy'.
	kb2: NULL, '\EOu'.
	kc1: NULL, '\EOq'.
	kc3: NULL, '\EOs'.
	kent: NULL, '\EOM'.
	ka2: NULL, '\EOx'.
	kb1: NULL, '\EOt'.
	kb3: NULL, '\EOv'.
	kc2: NULL, '\EOr'.
	kp5: NULL, '\EOE'.
	kpADD: NULL, '\EOk'.
	kpCMA: NULL, '\EOl'.
	kpDIV: NULL, '\EOo'.
	kpDOT: NULL, '\EOn'.
	kpMUL: NULL, '\EOj'.
	kpSUB: NULL, '\EOm'.
	kpZRO: NULL, '\EOp'.

I assume these were removed since private mode 1035 isn’t enabled by
default? Given that I can’t find any terminfo definitions that includes

right

So, this makes it pretty clear; remove everything that refers to non-default behavior.

#       status-line does not work because foot does not set the window
title
`` 

It does set the window title property. However, until very recently, it was
not rendered on CSDs[1]. This was not an issue with SSDs. Regardless, the
next release of foot will have support for rendering the window title on
CSDs.

I didn't see it in testing

Unsure if this means hs/fsl/hsl will be added (and if so, now, or at some random point in time in the future?) or not?

#       + does not report focus-in/focus-out

This one intrigues me. Just to ensure we’re on the same page - this refers
to the “CSI I” and “CSI O” reports, sent when the window gains and looses
keyboard focus? This has been verified to work on Weston, GNOME, KDE, Sway
and River. Thus I’m curious; what does your test setup look like, and how
did you test this?

Fedora 34, using vttest

A non-answer really. Fedora uses GNOME by default, so I'm just going to assume that's what he used while testing. Still have no idea how he tested. Doesn't matter though. As far as I'm concerned, this works. And, since it doesnt' affect the terminfo in any way, I'm just going to drop this.

	ich1: '\E[@', NULL.

Was adding ich1 intentional? terminfo(5) mentions that “technically, you
should not give both (ich1 and smir/rmir) unless the terminal actually
requires both to be used in combination”.

ncurses does this (tic's got a warning pointing out that some applications
don't work with that combination, but as I recall it, that's vi from about
30 years ago)

Sounds like it's ok to add ich1. But also that there's really no reason to do so. Perhaps this capability got pulled in by one of the many fragments the ncurses' version uses to build the foot terminfo?

[Reply](https://lists.gnu.org/archive/html/bug-ncurses/2021-08/msg00009.html) (I'm not including the full reply here, just the things I consider are worth commenting). (dickey's reply in the outermost quotes) > > > ``` > > > # tack: > > > # bell does not work > > > ``` > > > > It does, but is disabled by default. I’m not going to bore you with the > > details of how to configure it, but if you wanted it to play a bell sound, > > regardless of whether the window is focused or not, you would add something > > like this (to ~/.config/foot/foot.ini): > > If it's disabled, it doesn't belong in the terminal description. > > (a terminal description is a collection of features for a particular > configuration, including commonly-used features such as cursor-visibility > that can be altered using -- you guessed it -- the terminal description) and > > > ``` > > > # sends escape when meta key is used, whether or not smm/rmm > > > enabled > > > ``` > > > > Correct, but note that this is because foot has private mode 1036 enabled by > > default. Assuming it would be a bad idea to include 1036 in smm/rmm, I agree > > that removing km/smm/rmm better reflects foot’s default behavior. > > again, disabled by default makes it not part of the terminal description and > > > ``` > > > ka1: NULL, '\EOw'. > > > ka3: NULL, '\EOy'. > > > kb2: NULL, '\EOu'. > > > kc1: NULL, '\EOq'. > > > kc3: NULL, '\EOs'. > > > kent: NULL, '\EOM'. > > > ka2: NULL, '\EOx'. > > > kb1: NULL, '\EOt'. > > > kb3: NULL, '\EOv'. > > > kc2: NULL, '\EOr'. > > > kp5: NULL, '\EOE'. > > > kpADD: NULL, '\EOk'. > > > kpCMA: NULL, '\EOl'. > > > kpDIV: NULL, '\EOo'. > > > kpDOT: NULL, '\EOn'. > > > kpMUL: NULL, '\EOj'. > > > kpSUB: NULL, '\EOm'. > > > kpZRO: NULL, '\EOp'. > > > ``` > > I assume these were removed since private mode 1035 isn’t enabled by > > default? Given that I can’t find _any_ terminfo definitions that includes > > right So, this makes it pretty clear; remove everything that refers to non-default behavior. > > > ``` > > > # status-line does not work because foot does not set the window > > > title > > > `` > > > > It does set the window title property. However, until very recently, it was > > not rendered on CSDs[1]. This was not an issue with SSDs. Regardless, the > > next release of foot will have support for rendering the window title on > > CSDs. > > I didn't see it in testing Unsure if this means `hs`/`fsl`/`hsl` will be added (and if so, now, or at some random point in time in the future?) or not? > > > ``` > > > # + does not report focus-in/focus-out > > > ``` > > > > This one intrigues me. Just to ensure we’re on the same page - this refers > > to the “CSI I” and “CSI O” reports, sent when the window gains and looses > > keyboard focus? This has been verified to work on Weston, GNOME, KDE, Sway > > and River. Thus I’m curious; what does your test setup look like, and how > > did you test this? > > Fedora 34, using vttest A non-answer really. Fedora uses GNOME by default, so I'm just going to assume that's what he used while testing. Still have no idea _how_ he tested. Doesn't matter though. As far as I'm concerned, this works. And, since it doesnt' affect the terminfo in any way, I'm just going to drop this. > > > ``` > > > ich1: '\E[@', NULL. > > > ``` > > > > Was adding ich1 intentional? terminfo(5) mentions that “technically, you > > should not give both (ich1 and smir/rmir) unless the terminal actually > > requires both to be used in combination”. > > ncurses does this (tic's got a warning pointing out that some applications > don't work with that combination, but as I recall it, that's vi from about > 30 years ago) Sounds like it's ok to add `ich1`. But also that there's really no reason to do so. Perhaps this capability got pulled in by one of the many fragments the ncurses' version uses to build the foot terminfo?
Poster
Owner

My take away is that we should remove the keypad and meta-key (km/smm/rmm) definitions.

My take away is that we should remove the keypad and meta-key (km/smm/rmm) definitions.
dnkl referenced this issue from a commit 2 months ago
dnkl closed this issue 2 months ago
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.