@@ -206,18 +206,15 @@ function s:ExprCol()
206206 let bal = 0
207207 while s: SearchLoop (' [{}?:]' ,' bW' ,s: skip_expr )
208208 if s: LookingAt () == ' :'
209- if getline (' .' )[col (' .' )-2 ] == ' :'
210- call cursor (0 ,col (' .' )-1 )
211- continue
212- endif
213- let bal -= 1
209+ let bal -= ! search (' \m:\%#' ,' bW' )
214210 elseif s: LookingAt () == ' ?'
215211 if getline (' .' )[col (' .' ): col (' .' )+ 1 ] = ~ ' ^\.\d\@!'
216- continue
212+ " ?. conditional chain, not ternary start
217213 elseif ! bal
218214 return 1
215+ else
216+ let bal += 1
219217 endif
220- let bal += 1
221218 elseif s: LookingAt () == ' {'
222219 return ! s: IsBlock ()
223220 elseif ! s: GetPair (' {' ,' }' ,' bW' ,s: skip_expr )
@@ -365,8 +362,8 @@ function GetJavascriptIndent()
365362 return -1
366363 endif
367364
368- let s: l1 = max ([ 0 , prevnonblank ( v: lnum ) - ( s: rel ? 2000 : 1000 ),
369- \ get ( get ( b: , ' hi_indent ' ,{}), ' blocklnr ' ) ])
365+ let nest = get ( get ( b: , ' hi_indent ' ,{}), ' blocklnr ' )
366+ let s: l1 = max ([ 0 , prevnonblank ( v: lnum ) - ( s: rel ? 2000 : 1000 ), nest ])
370367 call cursor (v: lnum ,1 )
371368 if s: PreviousToken () is ' '
372369 return
@@ -468,9 +465,7 @@ function GetJavascriptIndent()
468465 return num_ind
469466 elseif num
470467 return s: Nat (num_ind + get (l: ,' case_offset' ,s: sw ()) + l: switch_offset + b_l + is_op)
471- endif
472- let nest = get (get (b: ,' hi_indent' ,{}),' blocklnr' )
473- if nest
468+ elseif nest
474469 return indent (nest) + s: sw () + b_l + is_op
475470 endif
476471 return b_l + is_op
0 commit comments