patch 8.1.1348: running tests may cause the window to move
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.
diff --git a/src/testdir/test_edit.vim b/src/testdir/test_edit.vim
index 381e09c..32569b6 100644
--- a/src/testdir/test_edit.vim
+++ b/src/testdir/test_edit.vim
@@ -1359,9 +1359,26 @@
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
diff --git a/src/version.c b/src/version.c
index 6166c15..a658c5a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -768,6 +768,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1348,
+/**/
1347,
/**/
1346,