diff runtime/indent/matlab.vim @ 18848:a0e0f0256d0b

Runtime file updates. Commit: https://github.com/vim/vim/commit/32b364fcc09749f35adb441b81291e1e5946dbc2 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Dec 8 15:07:48 2019 +0100 Runtime file updates.
author Bram Moolenaar <Bram@vim.org>
date Sun, 08 Dec 2019 15:15:04 +0100
parents 8b334e4cb97f
children 9c221ad9634a
line wrap: on
line diff
--- a/runtime/indent/matlab.vim
+++ b/runtime/indent/matlab.vim
@@ -29,7 +29,7 @@ if exists("*GetMatlabIndent") | finish |
 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 @@ let s:zflag = has('patch-7.4.984') ? 'z'
 
 " 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 @@ function! GetMatlabIndent()
 	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