summaryrefslogtreecommitdiffstats
path: root/src/testdir
diff options
context:
space:
mode:
authorSean Dewar <6256228+seandewar@users.noreply.github.com>2024-02-22 19:53:33 +0100
committerChristian Brabandt <cb@256bit.org>2024-02-22 19:53:33 +0100
commit2a65e739447949a7aee966ce8a3b75521b2a79ea (patch)
tree5d539accc41476eb1890ea81cf6728bffb545e64 /src/testdir
parent5e3674b42da10b7e7c72d1f20f9a15379af1b60a (diff)
patch 9.1.0128: win_gotoid() may abort even when not switching a windowv9.1.0128
Problem: win_gotoid() checks for textlock and other things when switching to a window that is already current (after v9.1.0119) Solution: return early with success when attempting to switch to curwin (Sean Dewar) Other potential causes of E565 from win_gotoid after v9.1.0119 should be correct. Plugins can consider using win_execute() instead if they wish to temporarily switch windows during textlock. fixes: #14073 closes: #14074 Signed-off-by: Sean Dewar <6256228+seandewar@users.noreply.github.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test_window_cmd.vim6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/testdir/test_window_cmd.vim b/src/testdir/test_window_cmd.vim
index a68ed74cb6..a70fb790c5 100644
--- a/src/testdir/test_window_cmd.vim
+++ b/src/testdir/test_window_cmd.vim
@@ -2225,6 +2225,10 @@ func Test_win_gotoid_splitmove_textlock_cmdwin()
set debug+=throw indentexpr=win_gotoid(win_getid(winnr('#')))
call assert_fails('normal! ==', 'E565:')
call assert_equal(curwin, win_getid())
+ " No error if attempting to switch to curwin; nothing happens.
+ set indentexpr=assert_equal(1,win_gotoid(win_getid()))
+ normal! ==
+ call assert_equal(curwin, win_getid())
set indentexpr=win_splitmove(winnr('#'),winnr())
call assert_fails('normal! ==', 'E565:')
@@ -2240,6 +2244,8 @@ func Test_win_gotoid_splitmove_textlock_cmdwin()
call feedkeys('q:'
\ .. ":call assert_fails('call win_gotoid(win_getid(winnr(''#'')))', 'E11:')\<CR>"
+ "\ No error if attempting to switch to curwin; nothing happens.
+ \ .. ":call assert_equal(1, win_gotoid(win_getid()))\<CR>"
\ .. ":call assert_equal('command', win_gettype())\<CR>"
\ .. ":call assert_equal('', win_gettype(winnr('#')))\<CR>", 'ntx')
endfunc