diff options
author | Christian Clason <c.clason@uni-graz.at> | 2022-08-20 10:04:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-20 10:04:55 +0200 |
commit | 1cc4706e94489498b12c4844c1b3a2e9aa5cc921 (patch) | |
tree | a2517116d23cceed4ccb41c38c40573b3a7a6c85 /runtime/autoload/python.vim | |
parent | bffaf1e27e49c3dbbc0b59d023a0fd9243e254aa (diff) | |
download | rneovim-1cc4706e94489498b12c4844c1b3a2e9aa5cc921.tar.gz rneovim-1cc4706e94489498b12c4844c1b3a2e9aa5cc921.tar.bz2 rneovim-1cc4706e94489498b12c4844c1b3a2e9aa5cc921.zip |
vim-patch:e80086446cc2 (#19848)
* vim-patch:e80086446cc2
Update runtime files
https://github.com/vim/vim/commit/e80086446cc20856ed8359bc8dc87c4d430da4c8
Co-authored-by: Sean Dewar <seandewar@users.noreply.github.com>
Diffstat (limited to 'runtime/autoload/python.vim')
-rw-r--r-- | runtime/autoload/python.vim | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/runtime/autoload/python.vim b/runtime/autoload/python.vim index 4b220708cf..e45dbd9db8 100644 --- a/runtime/autoload/python.vim +++ b/runtime/autoload/python.vim @@ -15,8 +15,9 @@ let s:maxoff = 50 " maximum number of lines to look backwards for () function s:SearchBracket(fromlnum, flags) return searchpairpos('[[({]', '', '[])}]', a:flags, - \ {-> synID('.', col('.'), v:true)->synIDattr('name') - \ =~ '\%(Comment\|Todo\|String\)$'}, + \ {-> synstack('.', col('.')) + \ ->map({_, id -> id->synIDattr('name')}) + \ ->match('\%(Comment\|Todo\|String\)$') >= 0}, \ [0, a:fromlnum - s:maxoff]->max(), s:searchpair_timeout) endfunction @@ -143,12 +144,16 @@ function python#GetIndent(lnum, ...) " If the last character in the line is a comment, do a binary search for " the start of the comment. synID() is slow, a linear search would take " too long on a long line. - if synIDattr(synID(plnum, pline_len, 1), "name") =~ "\\(Comment\\|Todo\\)" + if synstack(plnum, pline_len) + \ ->map({_, id -> id->synIDattr('name')}) + \ ->match('\%(Comment\|Todo\)$') >= 0 let min = 1 let max = pline_len while min < max let col = (min + max) / 2 - if synIDattr(synID(plnum, col, 1), "name") =~ "\\(Comment\\|Todo\\)" + if synstack(plnum, col) + \ ->map({_, id -> id->synIDattr('name')}) + \ ->match('\%(Comment\|Todo\)$') >= 0 let max = col else let min = col + 1 |