]> granicus.if.org Git - vim/commitdiff
patch 8.1.1127: getwinpos() doesn't work in terminal on MS-Windows console v8.1.1127
authorBram Moolenaar <Bram@vim.org>
Sat, 6 Apr 2019 18:00:19 +0000 (20:00 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 6 Apr 2019 18:00:19 +0000 (20:00 +0200)
Problem:    getwinpos() doesn't work in terminal on MS-Windows console.
Solution:   Adjust #ifdefs.  Disable test for MS-Windows console.

src/term.c
src/terminal.c
src/testdir/test_terminal.vim
src/ui.c
src/version.c

index d114be97819efeccc08ae9db4e8089d564f62b93..ff1adc9ad6ace3a9578af0e93a0787f2753b09bf 100644 (file)
@@ -2843,7 +2843,7 @@ static int winpos_x = -1;
 static int winpos_y = -1;
 static int did_request_winpos = 0;
 
-#  if (defined(FEAT_EVAL) && defined(HAVE_TGETENT)) || defined(PROTO)
+# if defined(FEAT_EVAL) || defined(FEAT_TERMINAL) || defined(PROTO)
 /*
  * Try getting the Vim window position from the terminal.
  * Returns OK or FAIL.
@@ -4858,7 +4858,7 @@ check_termcode(
 
                /*
                 * Check for a window position response from the terminal:
-                *       {lead}3;{x}:{y}t
+                *       {lead}3;{x};{y}t
                 */
                else if (did_request_winpos
                            && ((len >= 4 && tp[0] == ESC && tp[1] == '[')
@@ -4925,11 +4925,11 @@ check_termcode(
                        if (i - j >= 21 && STRNCMP(tp + j + 3, "rgb:", 4) == 0
                            && tp[j + 11] == '/' && tp[j + 16] == '/')
                        {
-#ifdef FEAT_TERMINAL
+# ifdef FEAT_TERMINAL
                            int rval = hexhex2nr(tp + j + 7);
                            int gval = hexhex2nr(tp + j + 12);
                            int bval = hexhex2nr(tp + j + 17);
-#endif
+# endif
                            if (is_bg)
                            {
                                char *newval = (3 * '6' < tp[j+7] + tp[j+12]
@@ -4937,11 +4937,11 @@ check_termcode(
 
                                LOG_TR(("Received RBG response: %s", tp));
                                rbg_status = STATUS_GOT;
-#ifdef FEAT_TERMINAL
+# ifdef FEAT_TERMINAL
                                bg_r = rval;
                                bg_g = gval;
                                bg_b = bval;
-#endif
+# endif
                                if (!option_was_set((char_u *)"bg")
                                                  && STRCMP(p_bg, newval) != 0)
                                {
@@ -4952,7 +4952,7 @@ check_termcode(
                                    redraw_asap(CLEAR);
                                }
                            }
-#ifdef FEAT_TERMINAL
+# ifdef FEAT_TERMINAL
                            else
                            {
                                LOG_TR(("Received RFG response: %s", tp));
@@ -4961,7 +4961,7 @@ check_termcode(
                                fg_g = gval;
                                fg_b = bval;
                            }
-#endif
+# endif
                        }
 
                        /* got finished code: consume it */
index 34dea0312c327c353c1b9e131bcb788438e240ac..4ff28b851896b5db5efe0224076a764501727a18 100644 (file)
@@ -3866,8 +3866,11 @@ parse_csi(
     if (command != 't' || argcount != 1 || args[0] != 13)
        return 0; // not handled
 
-    // When getting the window position fails it results in zero/zero.
+    // When getting the window position is not possible or it fails it results
+    // in zero/zero.
+#if defined(FEAT_GUI) || (defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE))
     (void)ui_get_winpos(&x, &y, (varnumber_T)100);
+#endif
 
     FOR_ALL_WINDOWS(wp)
        if (wp->w_buffer == term->tl_buffer)
index 4c84a432aacfe6144c27c6a8d98c2f81e5d8f015..1f994785c9bd8f9e8d07cb61d3c7903b875151fe 100644 (file)
@@ -1889,6 +1889,11 @@ func Test_terminal_statusline()
 endfunc
 
 func Test_terminal_getwinpos()
+  " does not work in the MS-Windows console
+  if has('win32') && !has('gui')
+    return
+  endif
+
   " split, go to the bottom-right window
   split
   wincmd j
index f78c570c8df6c1747ceaaa271943b32c593766ea..72148760d8855cd13000d0ac5d3017cbff2a5273 100644 (file)
--- a/src/ui.c
+++ b/src/ui.c
@@ -627,10 +627,9 @@ ui_new_shellsize(void)
     }
 }
 
-#if (defined(FEAT_EVAL) \
+#if ((defined(FEAT_EVAL) || defined(FEAT_TERMINAL)) \
            && (defined(FEAT_GUI) \
                || (defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE)))) \
-       || defined(FEAT_TERMINAL) \
        || defined(PROTO)
 /*
  * Get the window position in pixels, if possible.
@@ -645,6 +644,8 @@ ui_get_winpos(int *x, int *y, varnumber_T timeout)
 # endif
 # if defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE)
     return term_get_winpos(x, y, timeout);
+# else
+    return FAIL;
 # endif
 }
 #endif
index 9115a0047dd95bd066b5e35b1977573d6bb5d305..dfc986e45a2b5a8587bf3f77798d5f5276a9731d 100644 (file)
@@ -771,6 +771,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1127,
 /**/
     1126,
 /**/