@@ -347,15 +347,21 @@ function GetJavascriptIndent()
347
347
endif
348
348
349
349
" If we got a closing bracket on an empty line, find its match and indent
350
- " according to it. For parentheses we indent to its column - 1, for the
351
- " others we indent to the containing line's MSL's level. Return -1 if fail.
352
- let col = matchend (line , s: line_pre . ' []})]' )
353
- if col > 0 && ! s: IsInStringOrComment (v: lnum , col )
354
- call cursor (v: lnum , col )
355
- let parlnum = s: lookForParens (' (\|{\|\[' , ' )\|}\|\]' , ' nbW' , 0 )
356
- if parlnum > 0
357
- let ind = s: InMultiVarStatement (parlnum, 0 , 0 ) ? indent (parlnum) : indent (s: GetMSL (parlnum, 0 ))
358
- endif
350
+ " according to it.
351
+ let col = s: Match (v: lnum , s: line_pre . ' []})]' )
352
+ if col > 0
353
+ let parlnum = v: lnum
354
+ while col
355
+ call cursor (parlnum, 1 )
356
+ let parlnum = s: lookForParens (' (\|{\|\[' , ' )\|}\|\]' , ' nbW' , 0 )
357
+ let col = s: Match (parlnum, s: line_pre . ' []})]' )
358
+ if col
359
+ continue
360
+ end
361
+ if parlnum > 0
362
+ let ind = s: InMultiVarStatement (parlnum, 0 , 0 ) ? indent (parlnum) : indent (s: GetMSL (parlnum, 0 ))
363
+ endif
364
+ endwhile
359
365
return ind
360
366
endif
361
367
@@ -424,7 +430,8 @@ function GetJavascriptIndent()
424
430
425
431
" If the previous line ended with a block opening, add a level of indent.
426
432
if s: Match (lnum, s: block_regex )
427
- return s: InMultiVarStatement (lnum, 0 , 0 ) ? indent (lnum) + s: sw () : indent (s: GetMSL (lnum, 0 )) + s: sw ()
433
+ return s: InMultiVarStatement (lnum, 0 , 0 ) || s: Match (lnum, s: line_pre . ' []})]' ) ?
434
+ \ indent (lnum) + s: sw () : indent (s: GetMSL (lnum, 0 )) + s: sw ()
428
435
endif
429
436
430
437
" Set up variables for current line.
0 commit comments