aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-05-18 13:37:20 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-05-18 13:39:23 -0400
commitf286af170d57b85f59457ff16e6716163b69d8ba (patch)
tree8e1aa1bf04219a978df8361fad953d78fedf5ca7
parenta33010d1e1af3c61380285f1ecdcc0786674bf8d (diff)
downloadrneovim-f286af170d57b85f59457ff16e6716163b69d8ba.tar.gz
rneovim-f286af170d57b85f59457ff16e6716163b69d8ba.tar.bz2
rneovim-f286af170d57b85f59457ff16e6716163b69d8ba.zip
vim-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. https://github.com/vim/vim/commit/f8191c5f07c650b75b85c5a5b3d000fd5cae1643
-rw-r--r--src/nvim/testdir/test_edit.vim19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/nvim/testdir/test_edit.vim b/src/nvim/testdir/test_edit.vim
index de0f3ddb06..7f3994300f 100644
--- a/src/nvim/testdir/test_edit.vim
+++ b/src/nvim/testdir/test_edit.vim
@@ -1385,9 +1385,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