mirror of
https://github.com/neovim/neovim
synced 2025-07-16 01:01:49 +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#15568
81e7513c86
This commit is contained in:
@ -60,12 +60,8 @@ func s:Highlight_Matching_Pair()
|
||||
let before = 0
|
||||
|
||||
let text = getline(c_lnum)
|
||||
let matches = matchlist(text, '\(.\)\=\%'.c_col.'c\(.\=\)')
|
||||
if empty(matches)
|
||||
let [c_before, c] = ['', '']
|
||||
else
|
||||
let [c_before, c] = matches[1:2]
|
||||
endif
|
||||
let c_before = text->strpart(0, c_col - 1)->slice(-1)
|
||||
let c = text->strpart(c_col - 1)->slice(0, 1)
|
||||
let plist = split(&matchpairs, '.\zs[:,]')
|
||||
let i = index(plist, c)
|
||||
if i < 0
|
||||
|
Reference in New Issue
Block a user