Mercurial > vim
comparison src/testdir/test_window_cmd.vim @ 34407:8c4339d56b1b v9.1.0128
patch 9.1.0128: win_gotoid() may abort even when not switching a window
Commit: https://github.com/vim/vim/commit/2a65e739447949a7aee966ce8a3b75521b2a79ea
Author: Sean Dewar <6256228+seandewar@users.noreply.github.com>
Date: Thu Feb 22 19:53:33 2024 +0100
patch 9.1.0128: win_gotoid() may abort even when not switching a window
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>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 22 Feb 2024 20:00:08 +0100 |
parents | 8b0e390b61fe |
children | e0d4ce8ebf12 |
comparison
equal
deleted
inserted
replaced
34406:07e17450d57a | 34407:8c4339d56b1b |
---|---|
2223 call setline(1, 'bar') | 2223 call setline(1, 'bar') |
2224 | 2224 |
2225 set debug+=throw indentexpr=win_gotoid(win_getid(winnr('#'))) | 2225 set debug+=throw indentexpr=win_gotoid(win_getid(winnr('#'))) |
2226 call assert_fails('normal! ==', 'E565:') | 2226 call assert_fails('normal! ==', 'E565:') |
2227 call assert_equal(curwin, win_getid()) | 2227 call assert_equal(curwin, win_getid()) |
2228 " No error if attempting to switch to curwin; nothing happens. | |
2229 set indentexpr=assert_equal(1,win_gotoid(win_getid())) | |
2230 normal! == | |
2231 call assert_equal(curwin, win_getid()) | |
2228 | 2232 |
2229 set indentexpr=win_splitmove(winnr('#'),winnr()) | 2233 set indentexpr=win_splitmove(winnr('#'),winnr()) |
2230 call assert_fails('normal! ==', 'E565:') | 2234 call assert_fails('normal! ==', 'E565:') |
2231 call assert_equal(curwin, win_getid()) | 2235 call assert_equal(curwin, win_getid()) |
2232 | 2236 |
2238 \ .. ":call assert_equal('command', win_gettype())\<CR>" | 2242 \ .. ":call assert_equal('command', win_gettype())\<CR>" |
2239 \ .. ":call assert_equal('', win_gettype(winnr('#')))\<CR>", 'ntx') | 2243 \ .. ":call assert_equal('', win_gettype(winnr('#')))\<CR>", 'ntx') |
2240 | 2244 |
2241 call feedkeys('q:' | 2245 call feedkeys('q:' |
2242 \ .. ":call assert_fails('call win_gotoid(win_getid(winnr(''#'')))', 'E11:')\<CR>" | 2246 \ .. ":call assert_fails('call win_gotoid(win_getid(winnr(''#'')))', 'E11:')\<CR>" |
2247 "\ No error if attempting to switch to curwin; nothing happens. | |
2248 \ .. ":call assert_equal(1, win_gotoid(win_getid()))\<CR>" | |
2243 \ .. ":call assert_equal('command', win_gettype())\<CR>" | 2249 \ .. ":call assert_equal('command', win_gettype())\<CR>" |
2244 \ .. ":call assert_equal('', win_gettype(winnr('#')))\<CR>", 'ntx') | 2250 \ .. ":call assert_equal('', win_gettype(winnr('#')))\<CR>", 'ntx') |
2245 endfunc | 2251 endfunc |
2246 | 2252 |
2247 " vim: shiftwidth=2 sts=2 expandtab | 2253 " vim: shiftwidth=2 sts=2 expandtab |