mirror of
https://github.com/neovim/neovim.git
synced 2025-10-17 07:16:09 +00:00
vim-patch:9.1.0694: matchparen is slow on a long line (#30134)
Problem: The matchparen plugin is slow on a long line. Solution: Don't use a regexp to get char at and before cursor. (zeertzjq) Example: ```vim call setline(1, repeat(' foobar', 100000)) runtime plugin/matchparen.vim normal! $hhhhhhhh ``` closes: vim/vim#1556881e7513c86
(cherry picked from commitcf44121f7f
)
This commit is contained in:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
dca6c4e92c
commit
1ed493cc96
@@ -108,5 +108,35 @@ func Test_matchparen_pum_clear()
|
||||
call StopVimInTerminal(buf)
|
||||
endfunc
|
||||
|
||||
" Test that matchparen works with multibyte chars in 'matchpairs'
|
||||
func Test_matchparen_mbyte()
|
||||
CheckScreendump
|
||||
|
||||
let lines =<< trim END
|
||||
source $VIMRUNTIME/plugin/matchparen.vim
|
||||
call setline(1, ['aaaaaaaa(', 'bbbb)cc'])
|
||||
set matchpairs+=(:)
|
||||
END
|
||||
|
||||
call writefile(lines, 'XmatchparenMbyte', 'D')
|
||||
let buf = RunVimInTerminal('-S XmatchparenMbyte', #{rows: 10})
|
||||
call VerifyScreenDump(buf, 'Test_matchparen_mbyte_1', {})
|
||||
call term_sendkeys(buf, "$")
|
||||
call VerifyScreenDump(buf, 'Test_matchparen_mbyte_2', {})
|
||||
call term_sendkeys(buf, "j")
|
||||
call VerifyScreenDump(buf, 'Test_matchparen_mbyte_3', {})
|
||||
call term_sendkeys(buf, "2h")
|
||||
call VerifyScreenDump(buf, 'Test_matchparen_mbyte_4', {})
|
||||
call term_sendkeys(buf, "0")
|
||||
call VerifyScreenDump(buf, 'Test_matchparen_mbyte_5', {})
|
||||
call term_sendkeys(buf, "kA")
|
||||
call VerifyScreenDump(buf, 'Test_matchparen_mbyte_6', {})
|
||||
call term_sendkeys(buf, "\<Down>")
|
||||
call VerifyScreenDump(buf, 'Test_matchparen_mbyte_7', {})
|
||||
call term_sendkeys(buf, "\<C-W>")
|
||||
call VerifyScreenDump(buf, 'Test_matchparen_mbyte_8', {})
|
||||
|
||||
call StopVimInTerminal(buf)
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
Reference in New Issue
Block a user