Commit 5e473ebd ("terminfo: add additional entries, fix smkx/rmkx")
added entries `xr` and `rv`, but without proper escaping of the
backslashes. This commit adds the extras. Output of `infocmp` now
matches foot, kitty, et al.
These sequences have been used "informally" forever, and until recently
mode 1004 was included in Xterm's XM (enable mouse reporting) sequence.
But as of ncurses 6.4 patch 20231028, focus reporting mode is removed
from XM and added to new fe and fd capabilities. Xterm also includes
definitions for the actual focus events ("kxIN" and "kxOUT"), so include
those too.
Not sure this is _strictly_ necessary, but according to terminfo(5) a
conditional (`%?`) should have a closing `%` character after the "else"
part. Adding it just in case some parser somewhere depends on this.
The XM entry enables mouse reporting events to applications. An
application that supports mouse events may not necessarily support focus
events, so these should not be bundled together.
Vim includes focus reporting mode (1004) in their example XM entry in
their docs [1], but they do not actually use it in the default value XM
value [2].
Ncurses also includes only modes 1000 and (optionally) mode 1006 in
their mouse driver [3]. The ncurses documentation for XM similarly does
not mention focus reporting (mode 1004) anywhere [4].
Including focus reporting causes bugs in some programs that want to use
mouse mode but do not handle focus events (e.g. `htop`).
[1]: https://vimhelp.org/term.txt.html#xterm-terminfo-entries
[2]: 87ca5e86fa/src/term.c (L477)
[3]: 87c2c84cbd/doc/html/man/curs_mouse.3x.html (L339)
[4]: https://www.man7.org/linux/man-pages/man5/user_caps.5.html
Use "xterm-ghostty" as the primary terminfo name. This is a hack on a
hack...we use "xterm-ghostty" to prevent vim from breaking, and when we
do this as the default we break tcell-based applications (lazygit, aerc,
etc). tcell has a bug where the primary terminfo name must be the
value of TERM. https://github.com/gdamore/tcell/pull/639 fixes the issue
but is not merged yet.
Fixes: 779186ad ("config: add term config option")
Add entries for XM and xm, these tell certain applications how to enable
mouse and the format of response they will receive.
Fix 'kmous' entry to match standard terminfo files.
Add a terminfo entry for Smulx, which advertises support for curly,
dashed, dotted, etc underlines
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>