comparison src/term.c @ 16245:e0a6298bd70f v8.1.1127

patch 8.1.1127: getwinpos() doesn't work in terminal on MS-Windows console commit https://github.com/vim/vim/commit/6bc9305a02f77136e65347951618575b2033cbc9 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Apr 6 20:00:19 2019 +0200 patch 8.1.1127: getwinpos() doesn't work in terminal on MS-Windows console Problem: getwinpos() doesn't work in terminal on MS-Windows console. Solution: Adjust #ifdefs. Disable test for MS-Windows console.
author Bram Moolenaar <Bram@vim.org>
date Sat, 06 Apr 2019 20:15:03 +0200
parents ce6de8dab779
children 3d6b282e2d6e
comparison
equal deleted inserted replaced
16244:a15ec9bee99d 16245:e0a6298bd70f
2841 2841
2842 static int winpos_x = -1; 2842 static int winpos_x = -1;
2843 static int winpos_y = -1; 2843 static int winpos_y = -1;
2844 static int did_request_winpos = 0; 2844 static int did_request_winpos = 0;
2845 2845
2846 # if (defined(FEAT_EVAL) && defined(HAVE_TGETENT)) || defined(PROTO) 2846 # if defined(FEAT_EVAL) || defined(FEAT_TERMINAL) || defined(PROTO)
2847 /* 2847 /*
2848 * Try getting the Vim window position from the terminal. 2848 * Try getting the Vim window position from the terminal.
2849 * Returns OK or FAIL. 2849 * Returns OK or FAIL.
2850 */ 2850 */
2851 int 2851 int
4856 # endif 4856 # endif
4857 } 4857 }
4858 4858
4859 /* 4859 /*
4860 * Check for a window position response from the terminal: 4860 * Check for a window position response from the terminal:
4861 * {lead}3;{x}:{y}t 4861 * {lead}3;{x};{y}t
4862 */ 4862 */
4863 else if (did_request_winpos 4863 else if (did_request_winpos
4864 && ((len >= 4 && tp[0] == ESC && tp[1] == '[') 4864 && ((len >= 4 && tp[0] == ESC && tp[1] == '[')
4865 || (len >= 3 && tp[0] == CSI)) 4865 || (len >= 3 && tp[0] == CSI))
4866 && tp[(j = 1 + (tp[0] == ESC))] == '3' 4866 && tp[(j = 1 + (tp[0] == ESC))] == '3'
4923 int is_bg = argp[1] == '1'; 4923 int is_bg = argp[1] == '1';
4924 4924
4925 if (i - j >= 21 && STRNCMP(tp + j + 3, "rgb:", 4) == 0 4925 if (i - j >= 21 && STRNCMP(tp + j + 3, "rgb:", 4) == 0
4926 && tp[j + 11] == '/' && tp[j + 16] == '/') 4926 && tp[j + 11] == '/' && tp[j + 16] == '/')
4927 { 4927 {
4928 #ifdef FEAT_TERMINAL 4928 # ifdef FEAT_TERMINAL
4929 int rval = hexhex2nr(tp + j + 7); 4929 int rval = hexhex2nr(tp + j + 7);
4930 int gval = hexhex2nr(tp + j + 12); 4930 int gval = hexhex2nr(tp + j + 12);
4931 int bval = hexhex2nr(tp + j + 17); 4931 int bval = hexhex2nr(tp + j + 17);
4932 #endif 4932 # endif
4933 if (is_bg) 4933 if (is_bg)
4934 { 4934 {
4935 char *newval = (3 * '6' < tp[j+7] + tp[j+12] 4935 char *newval = (3 * '6' < tp[j+7] + tp[j+12]
4936 + tp[j+17]) ? "light" : "dark"; 4936 + tp[j+17]) ? "light" : "dark";
4937 4937
4938 LOG_TR(("Received RBG response: %s", tp)); 4938 LOG_TR(("Received RBG response: %s", tp));
4939 rbg_status = STATUS_GOT; 4939 rbg_status = STATUS_GOT;
4940 #ifdef FEAT_TERMINAL 4940 # ifdef FEAT_TERMINAL
4941 bg_r = rval; 4941 bg_r = rval;
4942 bg_g = gval; 4942 bg_g = gval;
4943 bg_b = bval; 4943 bg_b = bval;
4944 #endif 4944 # endif
4945 if (!option_was_set((char_u *)"bg") 4945 if (!option_was_set((char_u *)"bg")
4946 && STRCMP(p_bg, newval) != 0) 4946 && STRCMP(p_bg, newval) != 0)
4947 { 4947 {
4948 /* value differs, apply it */ 4948 /* value differs, apply it */
4949 set_option_value((char_u *)"bg", 0L, 4949 set_option_value((char_u *)"bg", 0L,
4950 (char_u *)newval, 0); 4950 (char_u *)newval, 0);
4951 reset_option_was_set((char_u *)"bg"); 4951 reset_option_was_set((char_u *)"bg");
4952 redraw_asap(CLEAR); 4952 redraw_asap(CLEAR);
4953 } 4953 }
4954 } 4954 }
4955 #ifdef FEAT_TERMINAL 4955 # ifdef FEAT_TERMINAL
4956 else 4956 else
4957 { 4957 {
4958 LOG_TR(("Received RFG response: %s", tp)); 4958 LOG_TR(("Received RFG response: %s", tp));
4959 rfg_status = STATUS_GOT; 4959 rfg_status = STATUS_GOT;
4960 fg_r = rval; 4960 fg_r = rval;
4961 fg_g = gval; 4961 fg_g = gval;
4962 fg_b = bval; 4962 fg_b = bval;
4963 } 4963 }
4964 #endif 4964 # endif
4965 } 4965 }
4966 4966
4967 /* got finished code: consume it */ 4967 /* got finished code: consume it */
4968 key_name[0] = (int)KS_EXTRA; 4968 key_name[0] = (int)KS_EXTRA;
4969 key_name[1] = (int)KE_IGNORE; 4969 key_name[1] = (int)KE_IGNORE;