Mercurial > vim
comparison src/testdir/test_vim9_builtin.vim @ 28522:da28696e5340 v8.2.4785
patch 8.2.4785: Visual mode not stopped if win_gotoid() goes to other buffer
Commit: https://github.com/vim/vim/commit/3aca0916f0dba6114ae0f7d5458763a934fe7a02
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Apr 18 18:32:19 2022 +0100
patch 8.2.4785: Visual mode not stopped if win_gotoid() goes to other buffer
Problem: Visual mode not stopped early enough if win_gotoid() goes to
another buffer. (Sergey Vlasov)
Solution: Stop Visual mode before jumping to another buffer. (closes #10217)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 18 Apr 2022 19:45:04 +0200 |
parents | fabe722b24e9 |
children | 373c70e3c542 |
comparison
equal
deleted
inserted
replaced
28521:74a4e4c0fc6a | 28522:da28696e5340 |
---|---|
1 " Test using builtin functions in the Vim9 script language. | 1 " Test using builtin functions in the Vim9 script language. |
2 | 2 |
3 source check.vim | 3 source check.vim |
4 source screendump.vim | |
4 import './vim9.vim' as v9 | 5 import './vim9.vim' as v9 |
5 | 6 |
6 " Test for passing too many or too few arguments to builtin functions | 7 " Test for passing too many or too few arguments to builtin functions |
7 func Test_internalfunc_arg_error() | 8 func Test_internalfunc_arg_error() |
8 let l =<< trim END | 9 let l =<< trim END |
4491 | 4492 |
4492 def Test_win_gotoid() | 4493 def Test_win_gotoid() |
4493 v9.CheckDefAndScriptFailure(['win_gotoid("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) | 4494 v9.CheckDefAndScriptFailure(['win_gotoid("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4494 enddef | 4495 enddef |
4495 | 4496 |
4497 func Test_win_gotoid_in_mapping() | |
4498 CheckScreendump | |
4499 | |
4500 if has('clipboard_working') | |
4501 let @* = 'foo' | |
4502 let lines =<< trim END | |
4503 set cmdheight=2 | |
4504 func On_click() | |
4505 call win_gotoid(getmousepos().winid) | |
4506 execute "norm! \<LeftMouse>" | |
4507 endfunc | |
4508 noremap <LeftMouse> <Cmd>call On_click()<CR> | |
4509 | |
4510 autocmd SafeState * echo 'reg = "' .. @* .. '"' | |
4511 | |
4512 call setline(1, range(20)) | |
4513 set nomodified | |
4514 botright new | |
4515 call setline(1, range(21, 40)) | |
4516 set nomodified | |
4517 | |
4518 func Click() | |
4519 map <silent> <F3> :call test_setmouse(3, 1)<CR> | |
4520 call feedkeys("\<F3>\<LeftMouse>\<LeftRelease>", "xt") | |
4521 endfunc | |
4522 END | |
4523 call writefile(lines, 'Xgotoscript') | |
4524 let buf = RunVimInTerminal('-S Xgotoscript', #{rows: 15, wait_for_ruler: 0}) | |
4525 call VerifyScreenDump(buf, 'Test_win_gotoid_1', {}) | |
4526 call term_sendkeys(buf, "3Gvl") | |
4527 call VerifyScreenDump(buf, 'Test_win_gotoid_2', {}) | |
4528 | |
4529 call term_sendkeys(buf, ":call Click()\<CR>") | |
4530 call VerifyScreenDump(buf, 'Test_win_gotoid_3', {}) | |
4531 | |
4532 call StopVimInTerminal(buf) | |
4533 call delete('Xgotoscript') | |
4534 endif | |
4535 endfunc | |
4536 | |
4496 def Test_win_id2tabwin() | 4537 def Test_win_id2tabwin() |
4497 v9.CheckDefAndScriptFailure(['win_id2tabwin("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) | 4538 v9.CheckDefAndScriptFailure(['win_id2tabwin("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) |
4498 enddef | 4539 enddef |
4499 | 4540 |
4500 def Test_win_id2win() | 4541 def Test_win_id2win() |