Skip to content

Commit f8191c5

Browse files
committed
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.
1 parent bd2d68c commit f8191c5

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

src/testdir/test_edit.vim

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1359,9 +1359,26 @@ func Test_edit_complete_very_long_name()
13591359
return
13601360
endtry
13611361

1362-
" Try to get the Vim window position before setting 'columns'.
1362+
" Try to get the Vim window position before setting 'columns', so that we can
1363+
" move the window back to where it was.
13631364
let winposx = getwinposx()
13641365
let winposy = getwinposy()
1366+
1367+
if winposx >= 0 && winposy >= 0 && !has('gui_running')
1368+
" We did get the window position, but xterm may report the wrong numbers.
1369+
" Move the window to the reported position and compute any offset.
1370+
exe 'winpos ' . winposx . ' ' . winposy
1371+
sleep 100m
1372+
let x = getwinposx()
1373+
if x >= 0
1374+
let winposx += winposx - x
1375+
endif
1376+
let y = getwinposy()
1377+
if y >= 0
1378+
let winposy += winposy - y
1379+
endif
1380+
endif
1381+
13651382
let save_columns = &columns
13661383
" Need at least about 1100 columns to reproduce the problem.
13671384
set columns=2000

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,8 @@ static char *(features[]) =
767767

768768
static int included_patches[] =
769769
{ /* Add new patch number below this line */
770+
/**/
771+
1348,
770772
/**/
771773
1347,
772774
/**/

0 commit comments

Comments
 (0)