]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.1.1348: running tests may cause the window to move v8.1.1348
authorBram Moolenaar <Bram@vim.org>
Sat, 18 May 2019 15:22:54 +0000 (17:22 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 18 May 2019 15:22:54 +0000 (17:22 +0200)
Problem:    Running tests may cause the window to move.
Solution:   Correct the reported window position for the offset with the
            position after ":winpos".  Works around an xterm bug.

src/testdir/test_edit.vim
src/version.c

index 381e09cb48201455ee618cfa907b0cba69ac7abc..32569b6254e7964bba7424998d4c93ba733accfc 100644 (file)
@@ -1359,9 +1359,26 @@ func Test_edit_complete_very_long_name()
     return
   endtry
 
-  " Try to get the Vim window position before setting 'columns'.
+  " Try to get the Vim window position before setting 'columns', so that we can
+  " move the window back to where it was.
   let winposx = getwinposx()
   let winposy = getwinposy()
+
+  if winposx >= 0 && winposy >= 0 && !has('gui_running')
+    " We did get the window position, but xterm may report the wrong numbers.
+    " Move the window to the reported position and compute any offset.
+    exe 'winpos ' . winposx . ' ' . winposy
+    sleep 100m
+    let x = getwinposx()
+    if x >= 0
+      let winposx += winposx - x
+    endif
+    let y = getwinposy()
+    if y >= 0
+      let winposy += winposy - y
+    endif
+  endif
+
   let save_columns = &columns
   " Need at least about 1100 columns to reproduce the problem.
   set columns=2000
index 6166c157cc3d1e63b8b5efad88693043b968a733..a658c5ab0a7b8883e1e0bde5c4ac12b02b515199 100644 (file)
@@ -767,6 +767,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1348,
 /**/
     1347,
 /**/