Update runtime files
This commit is contained in:
9
runtime/autoload/dist/vimindent.vim
vendored
9
runtime/autoload/dist/vimindent.vim
vendored
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user