From 7266587f3e52513328926d9229be7003323ceac8 Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Thu, 24 Apr 2014 23:33:28 +1000 Subject: [PATCH] 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. --- src/etc/vim/indent/rust.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/etc/vim/indent/rust.vim b/src/etc/vim/indent/rust.vim index f7ac357b23a7f..54094a7411967 100644 --- a/src/etc/vim/indent/rust.vim +++ b/src/etc/vim/indent/rust.vim @@ -105,7 +105,7 @@ function GetRustIndent(lnum) if prevline[len(prevline) - 1] == "," \ && s:get_line_trimmed(a:lnum) !~ "^\\s*[\\[\\]{}]" \ && prevline !~ "^\\s*fn\\s" - \ && prevline !~ "\\([^\\(\\)]\+,$" + \ && prevline !~ "([^()]\\+,$" " 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 " indent.