comparison src/term.c @ 18679:fd95d4dbeb37 v8.1.2331

patch 8.1.2331: the option.c file is still very big Commit: https://github.com/vim/vim/commit/7bae0b1bc84a95d565ffab38cf7f82ad21c656b6 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Nov 21 22:14:18 2019 +0100 patch 8.1.2331: the option.c file is still very big Problem: The option.c file is still very big. Solution: Move a few functions to where they fit better. (Yegappan Lakshmanan, closes #4895)
author Bram Moolenaar <Bram@vim.org>
date Thu, 21 Nov 2019 22:15:03 +0100
parents bbea1f108187
children 14d2a210fab1
comparison
equal deleted inserted replaced
18678:cb4a4b71df4a 18679:fd95d4dbeb37
2896 term_color(T_CAB, n); 2896 term_color(T_CAB, n);
2897 else if (*T_CSB) 2897 else if (*T_CSB)
2898 term_color(T_CSB, n); 2898 term_color(T_CSB, n);
2899 } 2899 }
2900 2900
2901 /*
2902 * Return "dark" or "light" depending on the kind of terminal.
2903 * This is just guessing! Recognized are:
2904 * "linux" Linux console
2905 * "screen.linux" Linux console with screen
2906 * "cygwin.*" Cygwin shell
2907 * "putty.*" Putty program
2908 * We also check the COLORFGBG environment variable, which is set by
2909 * rxvt and derivatives. This variable contains either two or three
2910 * values separated by semicolons; we want the last value in either
2911 * case. If this value is 0-6 or 8, our background is dark.
2912 */
2913 char_u *
2914 term_bg_default(void)
2915 {
2916 #if defined(MSWIN)
2917 /* DOS console is nearly always black */
2918 return (char_u *)"dark";
2919 #else
2920 char_u *p;
2921
2922 if (STRCMP(T_NAME, "linux") == 0
2923 || STRCMP(T_NAME, "screen.linux") == 0
2924 || STRNCMP(T_NAME, "cygwin", 6) == 0
2925 || STRNCMP(T_NAME, "putty", 5) == 0
2926 || ((p = mch_getenv((char_u *)"COLORFGBG")) != NULL
2927 && (p = vim_strrchr(p, ';')) != NULL
2928 && ((p[1] >= '0' && p[1] <= '6') || p[1] == '8')
2929 && p[2] == NUL))
2930 return (char_u *)"dark";
2931 return (char_u *)"light";
2932 #endif
2933 }
2934
2901 #if defined(FEAT_TERMGUICOLORS) || defined(PROTO) 2935 #if defined(FEAT_TERMGUICOLORS) || defined(PROTO)
2902 2936
2903 #define RED(rgb) (((long_u)(rgb) >> 16) & 0xFF) 2937 #define RED(rgb) (((long_u)(rgb) >> 16) & 0xFF)
2904 #define GREEN(rgb) (((long_u)(rgb) >> 8) & 0xFF) 2938 #define GREEN(rgb) (((long_u)(rgb) >> 8) & 0xFF)
2905 #define BLUE(rgb) (((long_u)(rgb) ) & 0xFF) 2939 #define BLUE(rgb) (((long_u)(rgb) ) & 0xFF)