diff options
author | Bram Moolenaar <Bram@vim.org> | 2023-02-27 15:49:53 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2023-02-27 15:49:53 +0000 |
commit | dd60c365cd2630794be84d63c4fe287124a30b97 (patch) | |
tree | 560fe950798f2987865d532ebe0e06e60b78f3cc /runtime/autoload | |
parent | 341f3876b34f47fdb1c82b0ad9bae448be73a220 (diff) | |
download | vim-git-dd60c365cd2630794be84d63c4fe287124a30b97.tar.gz |
Update runtime files
Diffstat (limited to 'runtime/autoload')
-rw-r--r-- | runtime/autoload/dist/vimindent.vim | 9 | ||||
-rw-r--r-- | runtime/autoload/python.vim | 9 |
2 files changed, 5 insertions, 13 deletions
diff --git a/runtime/autoload/dist/vimindent.vim b/runtime/autoload/dist/vimindent.vim index 8d86543cb..1306d1e36 100644 --- a/runtime/autoload/dist/vimindent.vim +++ b/runtime/autoload/dist/vimindent.vim @@ -1121,13 +1121,8 @@ def Is_IN_KeywordForLoop(line_1: string, line_2: string): bool # {{{3 enddef def InCommentOrString(): bool # {{{3 - for synID: number in synstack('.', col('.')) - if synIDattr(synID, 'name') =~ '\ccomment\|string\|heredoc' - return true - endif - endfor - - return false + return synstack('.', col('.')) + ->indexof((_, id: number): bool => synIDattr(id, 'name') =~ '\ccomment\|string\|heredoc') >= 0 enddef def AlsoClosesBlock(line_B: dict<any>): bool # {{{3 diff --git a/runtime/autoload/python.vim b/runtime/autoload/python.vim index 1eaad09ef..d5f486236 100644 --- a/runtime/autoload/python.vim +++ b/runtime/autoload/python.vim @@ -22,8 +22,7 @@ let s:maxoff = 50 " maximum number of lines to look backwards for () function s:SearchBracket(fromlnum, flags) return searchpairpos('[[({]', '', '[])}]', a:flags, \ {-> synstack('.', col('.')) - \ ->map({_, id -> id->synIDattr('name')}) - \ ->match('\%(Comment\|Todo\|String\)$') >= 0}, + \ ->indexof({_, id -> synIDattr(id, 'name') =~ '\%(Comment\|Todo\|String\)$'}) >= 0}, \ [0, a:fromlnum - s:maxoff]->max(), g:python_indent.searchpair_timeout) endfunction @@ -157,15 +156,13 @@ function python#GetIndent(lnum, ...) " the start of the comment. synID() is slow, a linear search would take " too long on a long line. if synstack(plnum, pline_len) - \ ->map({_, id -> id->synIDattr('name')}) - \ ->match('\%(Comment\|Todo\)$') >= 0 + \ ->indexof({_, id -> synIDattr(id, 'name') =~ '\%(Comment\|Todo\)$'}) >= 0 let min = 1 let max = pline_len while min < max let col = (min + max) / 2 if synstack(plnum, col) - \ ->map({_, id -> id->synIDattr('name')}) - \ ->match('\%(Comment\|Todo\)$') >= 0 + \ ->indexof({_, id -> synIDattr(id, 'name') =~ '\%(Comment\|Todo\)$'}) >= 0 let max = col else let min = col + 1 |