Runtime file updates.
diff --git a/runtime/indent/matlab.vim b/runtime/indent/matlab.vim
index d2818a1..6390445 100644
--- a/runtime/indent/matlab.vim
+++ b/runtime/indent/matlab.vim
@@ -29,7 +29,7 @@
let s:keepcpo = &cpo
set cpo&vim
-let s:end = '\<end\>\%([^(]*)\)\@!' " Array indexing heuristic
+let s:end = '\<end\>\%([^({]*[)}]\)\@!' " Array indexing heuristic
let s:open_pat = 'for\|if\|parfor\|spmd\|switch\|try\|while\|classdef\|properties\|methods\|events\|enumeration'
let s:dedent_pat = '\C^\s*\zs\<\%(end\|else\|elseif\|catch\|\(case\|otherwise\|function\)\)\>'
let s:start_pat = '\C\<\%(function\|' . s:open_pat . '\)\>'
@@ -38,7 +38,7 @@
" Returns whether a comment or string envelops the specified column.
function! s:IsCommentOrString(lnum, col)
- return synIDattr(synID(a:lnum, a:col, 1), "name") =~# 'matlabComment\|matlabMultilineComment\|matlabString'
+ return synIDattr(synID(a:lnum, a:col, 1), "name") =~# 'matlabComment\|matlabMultilineComment\|matlabCellComment\|matlabString'
endfunction
" Returns whether the specified line continues on the next line.
@@ -105,7 +105,7 @@
else
" Count how many blocks the previous line opens/closes
" Line continuations/brackets indent once per statement
- let result = indent(prevlnum) + shiftwidth() * (open - close
+ let result = (prevlnum > 0) * indent(prevlnum) + shiftwidth() * (open - close
\ + (b:MATLAB_bracketlevel ? -!curbracketlevel : !!curbracketlevel)
\ + (curbracketlevel <= 0) * (above_lc - b:MATLAB_waslc))
endif
diff --git a/runtime/indent/testdir/matlab.in b/runtime/indent/testdir/matlab.in
index 5bba1a5..b997ec8 100644
--- a/runtime/indent/testdir/matlab.in
+++ b/runtime/indent/testdir/matlab.in
@@ -37,6 +37,7 @@
% START_INDENT
if true
A(1:end - 1)
+C{1:end - 1}
disp foo
end
% END_INDENT
@@ -50,6 +51,14 @@
% END_INDENT
% START_INDENT
+if true
+% end
+%% end
+disp foo
+end
+% END_INDENT
+
+% START_INDENT
% INDENT_EXE let b:MATLAB_function_indent = 0
function foo
disp foo
diff --git a/runtime/indent/testdir/matlab.ok b/runtime/indent/testdir/matlab.ok
index b111226..df4e7b2 100644
--- a/runtime/indent/testdir/matlab.ok
+++ b/runtime/indent/testdir/matlab.ok
@@ -37,6 +37,7 @@
% START_INDENT
if true
A(1:end - 1)
+ C{1:end - 1}
disp foo
end
% END_INDENT
@@ -50,6 +51,14 @@
% END_INDENT
% START_INDENT
+if true
+ % end
+ %% end
+ disp foo
+end
+% END_INDENT
+
+% START_INDENT
% INDENT_EXE let b:MATLAB_function_indent = 0
function foo
disp foo
diff --git a/runtime/indent/testdir/runtest.vim b/runtime/indent/testdir/runtest.vim
index 9502c42..b234a1a 100644
--- a/runtime/indent/testdir/runtest.vim
+++ b/runtime/indent/testdir/runtest.vim
@@ -116,6 +116,7 @@
echoerr 'Test ' . fname . ' FAILED!'
else
exe 'write ' . root . '.out'
+ echo "Test " . fname . " OK\n"
endif
quit! " close the indented file