comparison src/option.c @ 12383:1890536614ea v8.0.1071

patch 8.0.1071: putty-color and cygwin-color are not recognized commit https://github.com/vim/vim/commit/c6da01a5b8efe9ca4931074c0cf2189d357707a2 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Sep 7 22:37:36 2017 +0200 patch 8.0.1071: putty-color and cygwin-color are not recognized Problem: $TERM names starting with "putty" and "cygwin" are likely to have a dark background, but are not recognized. Solution: Only check the first few characters of $TERM to match "putty" or "cygwin". (Christian Brabandt)
author Christian Brabandt <cb@256bit.org>
date Thu, 07 Sep 2017 22:45:04 +0200
parents 2a8890b80923
children 61d910f0999d
comparison
equal deleted inserted replaced
12382:4a9568a1ea5f 12383:1890536614ea
4022 /* 4022 /*
4023 * Return "dark" or "light" depending on the kind of terminal. 4023 * Return "dark" or "light" depending on the kind of terminal.
4024 * This is just guessing! Recognized are: 4024 * This is just guessing! Recognized are:
4025 * "linux" Linux console 4025 * "linux" Linux console
4026 * "screen.linux" Linux console with screen 4026 * "screen.linux" Linux console with screen
4027 * "cygwin" Cygwin shell 4027 * "cygwin.*" Cygwin shell
4028 * "putty" Putty program 4028 * "putty.*" Putty program
4029 * We also check the COLORFGBG environment variable, which is set by 4029 * We also check the COLORFGBG environment variable, which is set by
4030 * rxvt and derivatives. This variable contains either two or three 4030 * rxvt and derivatives. This variable contains either two or three
4031 * values separated by semicolons; we want the last value in either 4031 * values separated by semicolons; we want the last value in either
4032 * case. If this value is 0-6 or 8, our background is dark. 4032 * case. If this value is 0-6 or 8, our background is dark.
4033 */ 4033 */
4034 static char_u * 4034 static char_u *
4035 term_bg_default(void) 4035 term_bg_default(void)
4036 { 4036 {
4037 #if defined(WIN3264) 4037 #if defined(WIN3264)
4038 /* DOS console nearly always black */ 4038 /* DOS console is nearly always black */
4039 return (char_u *)"dark"; 4039 return (char_u *)"dark";
4040 #else 4040 #else
4041 char_u *p; 4041 char_u *p;
4042 4042
4043 if (STRCMP(T_NAME, "linux") == 0 4043 if (STRCMP(T_NAME, "linux") == 0
4044 || STRCMP(T_NAME, "screen.linux") == 0 4044 || STRCMP(T_NAME, "screen.linux") == 0
4045 || STRCMP(T_NAME, "cygwin") == 0 4045 || STRNCMP(T_NAME, "cygwin", 6) == 0
4046 || STRCMP(T_NAME, "putty") == 0 4046 || STRNCMP(T_NAME, "putty", 5) == 0
4047 || ((p = mch_getenv((char_u *)"COLORFGBG")) != NULL 4047 || ((p = mch_getenv((char_u *)"COLORFGBG")) != NULL
4048 && (p = vim_strrchr(p, ';')) != NULL 4048 && (p = vim_strrchr(p, ';')) != NULL
4049 && ((p[1] >= '0' && p[1] <= '6') || p[1] == '8') 4049 && ((p[1] >= '0' && p[1] <= '6') || p[1] == '8')
4050 && p[2] == NUL)) 4050 && p[2] == NUL))
4051 return (char_u *)"dark"; 4051 return (char_u *)"dark";