Patch 9.0.1080 (after 9.0.1073) 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. Files: runtime/doc/term.txt, src/term.c, src/os_unix.c
*** ../vim-9.0.1079/runtime/doc/term.txt 2022-12-18 17:47:11.430957013 +0000 --- runtime/doc/term.txt 2022-12-19 18:54:22.413876147 +0000 *************** *** 306,314 **** 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. Note that using the kitty keyboard protocol is a separate feature, see |kitty-keyboard-protocol|. --- 307,320 ---- 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, 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|. *** ../vim-9.0.1079/src/term.c 2022-12-18 17:47:11.430957013 +0000 --- src/term.c 2022-12-19 18:42:33.912112976 +0000 *************** *** 1675,1680 **** --- 1675,1686 ---- #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,2046 **** #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)) { --- 2039,2044 ---- *************** *** 2060,2065 **** --- 2058,2076 ---- } #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,2638 **** 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; --- 2622,2629 ---- *************** *** 2644,2653 **** // 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 } /* --- 2635,2640 ---- *** ../vim-9.0.1079/src/os_unix.c 2022-12-01 12:03:42.263227523 +0000 --- src/os_unix.c 2022-12-19 18:28:04.142328442 +0000 *************** *** 2353,2358 **** --- 2353,2360 ---- /* * 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,2366 **** { if (name == NULL) return FALSE; ! return (STRNICMP(name, "xterm", 5) == 0 || STRNICMP(name, "nxterm", 6) == 0 || STRNICMP(name, "kterm", 5) == 0 || STRNICMP(name, "mlterm", 6) == 0 --- 2362,2369 ---- { if (name == NULL) return FALSE; ! 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 *** ../vim-9.0.1079/src/version.c 2022-12-19 16:49:23.886882904 +0000 --- src/version.c 2022-12-19 18:50:33.182412556 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1080, /**/ -- WOMAN: King of the who? ARTHUR: The Britons. WOMAN: Who are the Britons? ARTHUR: Well, we all are. we're all Britons and I am your king. The Quest for the Holy Grail (Monty Python) /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org /// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/20221219185720.E48A61C09D3%40moolenaar.net.