Source: vim Version: 2:9.0.1000 Severity: normal Tags: patch -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
Hi, could you please consider backporting patch 9.0.1080? It is needed to fix the keyprotocol option on the foot terminal, according to this upstream bug report: https://github.com/vim/vim/issues/11781 Thank you! - -- System Information: Debian Release: bookworm/sid APT prefers testing APT policy: (990, 'testing'), (500, 'unstable') Architecture: amd64 (x86_64) Kernel: Linux 6.0.0-6-amd64 (SMP w/4 CPU threads; PREEMPT) Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE Locale: LANG=it_IT.UTF-8, LC_CTYPE=it_IT.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled -----BEGIN PGP SIGNATURE----- iIoEARYIADIWIQS6VuNIvZRFHt7JcAdKkgiiRVB3pwUCY8XEXRQcYW5kcmVhQHBh cHBhY29kYS5pdAAKCRBKkgiiRVB3p4VHAQDZd1dcTYGJqznuA/yr06TlCBxKvQDc mBryv33hDyJ0OgEAwopHjy9lTATjeR1Pw3IrEUXwKsQZPuignkxI+aaQigc= =lowV -----END PGP SIGNATURE-----
>From afa3f1cc7258d34c32a299a3cc6aece89f67fb47 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar <b...@vim.org> Date: Mon, 19 Dec 2022 18:56:48 +0000 Subject: [PATCH] patch 9.0.1080: the "kitty" terminfo entry is not widespread Problem: The "kitty" terminfo entry is not widespread, resulting in the kitty terminal not working properly. Solution: Go back to using "xterm-kitty" and avoid the problems it causes in another way. --- runtime/doc/term.txt | 11 +++++++--- src/os_unix.c | 5 ++++- src/term.c | 51 +++++++++++++++++--------------------------- src/version.c | 2 ++ 4 files changed, 33 insertions(+), 36 deletions(-) diff --git a/runtime/doc/term.txt b/runtime/doc/term.txt index 50ba187ab969..146ef478fe53 100644 --- a/runtime/doc/term.txt +++ b/runtime/doc/term.txt @@ -306,9 +306,14 @@ One of the problems is that the value for $TERM is set to "xterm-kitty". For Vim this is an indication that the terminal is xterm-compatible and the builtin xterm termcap entries should be used. Many other terminals depend on this. However, Kitty is not fully xterm compatible. The author suggested to -ignore the "xterm-" prefix and use the terminfo entry anyway, but that -conflicts with what is needed for other terminals. Therefore Vim removes the -"xterm-" prefix from "xterm-kitty" when it comes from $TERM. +ignore the "xterm-" prefix and use the terminfo entry anyway, so that is what +happens now, the builtin xterm termcap entries are not used. However, the +t_RV is set, otherwise other things would not work, such as automatically +setting 'ttymouse' to "sgr". + +It is not clear why kitty sets $TERM to "xterm-kitty", the terminal isn't +really xterm compatible. "kitty" would be more appropriate, but a terminfo +entry with that name is not widespread. Note that using the kitty keyboard protocol is a separate feature, see |kitty-keyboard-protocol|. diff --git a/src/os_unix.c b/src/os_unix.c index bd75ccae1403..9d8d466507ca 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -2353,6 +2353,8 @@ mch_restore_title(int which) /* * Return TRUE if "name" looks like some xterm name. * This matches "xterm.*", thus "xterm-256color", "xterm-kitty", etc. + * Do not consider "xterm-kitty" an xterm, it is not fully xterm compatible, + * using the "xterm-kitty" terminfo entry should work better. * Seiichi Sato mentioned that "mlterm" works like xterm. */ int @@ -2360,7 +2362,8 @@ vim_is_xterm(char_u *name) { if (name == NULL) return FALSE; - return (STRNICMP(name, "xterm", 5) == 0 + return ((STRNICMP(name, "xterm", 5) == 0 + && STRNICMP(name, "xterm-kitty", 11) != 0) || STRNICMP(name, "nxterm", 6) == 0 || STRNICMP(name, "kterm", 5) == 0 || STRNICMP(name, "mlterm", 6) == 0 diff --git a/src/term.c b/src/term.c index 7a70af450ca3..cd6b3b9cf62b 100644 --- a/src/term.c +++ b/src/term.c @@ -1675,6 +1675,12 @@ static char *(key_names[]) = #endif #ifdef HAVE_TGETENT +/* + * Get the termcap entries we need with tgetstr(), tgetflag() and tgetnum(). + * "invoke_tgetent()" must have been called before. + * If "*height" or "*width" are not zero then use the "li" and "col" entries to + * get their value. + */ static void get_term_entries(int *height, int *width) { @@ -2033,14 +2039,6 @@ set_termname(char_u *term) #endif parse_builtin_tcap(term); - // Use the 'keyprotocol' option to adjust the t_TE and t_TI - // termcap entries if there is an entry maching "term". - keyprot_T kpc = match_keyprotocol(term); - if (kpc == KEYPROTOCOL_KITTY) - apply_builtin_tcap(term, builtin_kitty, TRUE); - else if (kpc == KEYPROTOCOL_MOK2) - apply_builtin_tcap(term, builtin_mok2, TRUE); - #ifdef FEAT_GUI if (term_is_gui(term)) { @@ -2060,6 +2058,19 @@ set_termname(char_u *term) } #endif +#ifdef FEAT_GUI + if (!gui.in_use) +#endif + { + // Use the 'keyprotocol' option to adjust the t_TE and t_TI + // termcap entries if there is an entry maching "term". + keyprot_T kpc = match_keyprotocol(term); + if (kpc == KEYPROTOCOL_KITTY) + apply_builtin_tcap(term, builtin_kitty, TRUE); + else if (kpc == KEYPROTOCOL_MOK2) + apply_builtin_tcap(term, builtin_mok2, TRUE); + } + /* * special: There is no info in the termcap about whether the cursor * positioning is relative to the start of the screen or to the start of the @@ -2611,28 +2622,8 @@ termcapinit(char_u *name) term = NULL; // empty name is equal to no name #ifndef MSWIN - char_u *tofree = NULL; if (term == NULL) - { term = mch_getenv((char_u *)"TERM"); - - // "xterm-kitty" is used for Kitty, but it is not actually compatible - // with xterm. Remove the "xterm-" part to avoid trouble. - if (term != NULL && STRNCMP(term, "xterm-kitty", 11) == 0) - { -#ifdef FEAT_EVAL - ch_log(NULL, "Removing xterm- prefix from terminal name %s", term); -#endif - if (p_verbose > 0) - { - verbose_enter(); - smsg(_("Removing xterm- prefix from terminal name %s"), term); - verbose_leave(); - } - term = vim_strsave(term + 6); - tofree = term; - } - } #endif if (term == NULL || *term == NUL) term = DEFAULT_TERM; @@ -2644,10 +2635,6 @@ termcapinit(char_u *name) // Avoid using "term" here, because the next mch_getenv() may overwrite it. set_termname(T_NAME != NULL ? T_NAME : term); - -#ifndef MSWIN - vim_free(tofree); -#endif } /* diff --git a/src/version.c b/src/version.c index 401d78bd3b85..a2371286c9e9 100644 --- a/src/version.c +++ b/src/version.c @@ -695,6 +695,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1080, /**/ 1079, /**/