To: vim_dev@googlegroups.com Subject: Patch 8.0.1033 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1033 Problem: Detecting background color does not work in screen, even when it is working like an xterm. Solution: Make "screen.xterm" use termcap entries like an xterm. (Lubomir Rintel, closes #2048) When termresponse version is huge also recognize as not being an xterm. Files: src/os_unix.c, src/term.c *** ../vim-8.0.1032/src/os_unix.c 2017-08-26 22:02:45.865432901 +0200 --- src/os_unix.c 2017-09-01 19:45:55.403806673 +0200 *************** *** 2280,2285 **** --- 2280,2286 ---- || STRNICMP(name, "kterm", 5) == 0 || STRNICMP(name, "mlterm", 6) == 0 || STRNICMP(name, "rxvt", 4) == 0 + || STRNICMP(name, "screen.xterm", 12) == 0 || STRCMP(name, "builtin_xterm") == 0); } *** ../vim-8.0.1032/src/term.c 2017-08-31 20:17:55.406492134 +0200 --- src/term.c 2017-09-01 20:00:16.950036651 +0200 *************** *** 4496,4501 **** --- 4496,4503 ---- /* eat it when at least one digit and ending in 'c' */ if (*T_CRV != NUL && i > 2 + (tp[0] != CSI) && tp[i] == 'c') { + int version = col; + LOG_TR("Received CRV response"); crv_status = STATUS_GOT; # ifdef FEAT_AUTOCMD *************** *** 4508,4517 **** switch_to_8bit(); /* rxvt sends its version number: "20703" is 2.7.3. * Ignore it for when the user has set 'term' to xterm, * even though it's an rxvt. */ ! if (col > 20000) ! col = 0; if (tp[1 + (tp[0] != CSI)] == '>' && semicols == 2) { --- 4510,4520 ---- switch_to_8bit(); /* rxvt sends its version number: "20703" is 2.7.3. + * Screen sends 40500. * Ignore it for when the user has set 'term' to xterm, * even though it's an rxvt. */ ! if (version > 20000) ! version = 0; if (tp[1 + (tp[0] != CSI)] == '>' && semicols == 2) { *************** *** 4522,4540 **** if (!option_was_set((char_u *)"ttym")) { # ifdef TTYM_SGR ! if (col >= 277) set_option_value((char_u *)"ttym", 0L, (char_u *)"sgr", 0); else # endif /* if xterm version >= 95 use mouse dragging */ ! if (col >= 95) set_option_value((char_u *)"ttym", 0L, (char_u *)"xterm2", 0); } /* if xterm version >= 141 try to get termcap codes */ ! if (col >= 141) { LOG_TR("Enable checking for XT codes"); check_for_codes = TRUE; --- 4525,4543 ---- if (!option_was_set((char_u *)"ttym")) { # ifdef TTYM_SGR ! if (version >= 277) set_option_value((char_u *)"ttym", 0L, (char_u *)"sgr", 0); else # endif /* if xterm version >= 95 use mouse dragging */ ! if (version >= 95) set_option_value((char_u *)"ttym", 0L, (char_u *)"xterm2", 0); } /* if xterm version >= 141 try to get termcap codes */ ! if (version >= 141) { LOG_TR("Enable checking for XT codes"); check_for_codes = TRUE; *************** *** 4543,4549 **** } /* libvterm sends 0;100;0 */ ! if (col == 100 && STRNCMP(tp + extra - 2, "0;100;0c", 8) == 0) { /* If run from Vim $COLORS is set to the number of --- 4546,4552 ---- } /* libvterm sends 0;100;0 */ ! if (version == 100 && STRNCMP(tp + extra - 2, "0;100;0c", 8) == 0) { /* If run from Vim $COLORS is set to the number of *************** *** 4558,4581 **** * compatible. */ # ifdef MACOS /* Mac Terminal.app sends 1;95;0 */ ! if (col == 95 && STRNCMP(tp + extra - 2, "1;95;0c", 7) == 0) is_not_xterm = TRUE; # endif /* Gnome terminal sends 1;3801;0 or 1;4402;0. * xfce4-terminal sends 1;2802;0. * Assuming any version number over 2800 is not an ! * xterm. */ if (col >= 2800) is_not_xterm = TRUE; /* PuTTY sends 0;136;0 */ ! if (col == 136 && STRNCMP(tp + extra - 2, "0;136;0c", 8) == 0) is_not_xterm = TRUE; /* Konsole sends 0;115;0 */ ! if (col == 115 && STRNCMP(tp + extra - 2, "0;115;0c", 8) == 0) is_not_xterm = TRUE; --- 4561,4585 ---- * compatible. */ # ifdef MACOS /* Mac Terminal.app sends 1;95;0 */ ! if (version == 95 && STRNCMP(tp + extra - 2, "1;95;0c", 7) == 0) is_not_xterm = TRUE; # endif /* Gnome terminal sends 1;3801;0 or 1;4402;0. * xfce4-terminal sends 1;2802;0. + * screen sends 83;40500;0 * Assuming any version number over 2800 is not an ! * xterm (without the limit for rxvt and screen). */ if (col >= 2800) is_not_xterm = TRUE; /* PuTTY sends 0;136;0 */ ! if (version == 136 && STRNCMP(tp + extra - 2, "0;136;0c", 8) == 0) is_not_xterm = TRUE; /* Konsole sends 0;115;0 */ ! if (version == 115 && STRNCMP(tp + extra - 2, "0;115;0c", 8) == 0) is_not_xterm = TRUE; *** ../vim-8.0.1032/src/version.c 2017-09-01 18:41:22.833711590 +0200 --- src/version.c 2017-09-01 19:47:28.827185015 +0200 *************** *** 771,772 **** --- 771,774 ---- { /* Add new patch number below this line */ + /**/ + 1033, /**/ -- hundred-and-one symptoms of being an internet addict: 40. You tell the cab driver you live at http://123.elm.street/house/bluetrim.html 41. You actually try that 123.elm.street address. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///