Fix Vim indent regressions from #13600.
The change in #13600 was incorrect, containing a bad regular expression; inside an indent function, errors are silently ignored (and the ``~=`` operation will return 0), so it just always failed, causing the cases that were supposed to be caught to not be caught and making things like the ``match`` example shown above or struct field definitions regress. I have fixed the regular expression to what it should have been. This is still imperfect, of course, not handling cases like where the first argument to a function is a function call (``foo(bar(),``), but it'll do for now.
This commit is contained in:
parent
e01e78fd00
commit
7266587f3e
@ -105,7 +105,7 @@ function GetRustIndent(lnum)
|
|||||||
if prevline[len(prevline) - 1] == ","
|
if prevline[len(prevline) - 1] == ","
|
||||||
\ && s:get_line_trimmed(a:lnum) !~ "^\\s*[\\[\\]{}]"
|
\ && s:get_line_trimmed(a:lnum) !~ "^\\s*[\\[\\]{}]"
|
||||||
\ && prevline !~ "^\\s*fn\\s"
|
\ && prevline !~ "^\\s*fn\\s"
|
||||||
\ && prevline !~ "\\([^\\(\\)]\+,$"
|
\ && prevline !~ "([^()]\\+,$"
|
||||||
" Oh ho! The previous line ended in a comma! I bet cindent will try to
|
" Oh ho! The previous line ended in a comma! I bet cindent will try to
|
||||||
" take this too far... For now, let's normally use the previous line's
|
" take this too far... For now, let's normally use the previous line's
|
||||||
" indent.
|
" indent.
|
||||||
|
Loading…
Reference in New Issue
Block a user