@@ -117,6 +117,10 @@ function s:label_end(ln,con)
117117 \ (expand (' <cword>' ) !=# ' default' || s: previous_token (1 ) !~ ' [{,.]' )
118118endfunction
119119
120+ function s: jump_label (ln ,con)
121+ return ! cursor (a: ln ,match (' ' .a: con , ' :$' )) && s: previous_token () = ~ ' \k' && s: IsBlock ()
122+ endfunction
123+
120124" configurable regexes that define continuation lines, not including (, {, or [.
121125let s: opfirst = ' ^' . get (g: ,' javascript_opfirst' ,
122126 \ ' \%([<>=,?^%|*/&]\|\([-.:+]\)\1\@!\|!=\|in\%(stanceof\)\=\>\)' )
@@ -195,6 +199,7 @@ endfunction
195199" lineNr which encloses the entire context, 'cont' if whether line 'i' + 1 is
196200" a continued expression, which could have started in a braceless context
197201function s: iscontOne (i ,num,cont)
202+ call cursor (v: lnum ,1 ) " normalize pos
198203 let [l: i , l: num , bL] = [a: i , a: num + ! a: num , 0 ]
199204 let pind = a: num ? indent (l: num ) + s: W : 0
200205 let ind = indent (l: i ) + (a: cont ? 0 : s: W )
@@ -308,10 +313,9 @@ function GetJavascriptIndent()
308313 return indent (l: lnum ) + s: W
309314 endif
310315 endif
311- call cursor (v: lnum ,1 ) " normalize pos
312316 endif
313317 if pline[-1 :] !~ ' [{;]'
314- let isOp = l: line = ~# s: opfirst || s: continues (l: lnum ,pline)
318+ let isOp = ! s: jump_label ( l: lnum ,pline) && ( l: line = ~# s: opfirst || s: continues (l: lnum ,pline) )
315319 let bL = s: iscontOne (l: lnum ,num,isOp)
316320 let bL -= (bL && l: line [0 ] == ' {' ) * s: W
317321 endif
0 commit comments