Skip to content

Commit e7df098

Browse files
authored
let a continuation be determined with block close
seems to fix #491, may be necessary to look for a more complex solution if this causes regressions
1 parent 0e08785 commit e7df098

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

indent/javascript.vim

+3-3
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ function s:GetMSL(lnum, in_one_line_scope)
140140
" Start on the line we're at and use its indent.
141141
let msl = a:lnum
142142
let lnum = s:PrevNonBlankNonString(a:lnum - 1)
143-
while lnum > 0
143+
while lnum > 0 && !s:Match(msl,s:line_pre . '[])}]')
144144
" If we have a continuation line, or we're in a string, use line as MSL.
145145
" Otherwise, terminate search as we have found our MSL already.
146146
let line = getline(lnum)
@@ -360,8 +360,8 @@ function GetJavascriptIndent()
360360
continue
361361
end
362362
if parlnum > 0
363-
let ind = s:InMultiVarStatement(parlnum, 0, 0)|| s:LineHasOpeningBrackets(parlnum) !~ '2'
364-
\ ? indent(parlnum) : indent(s:GetMSL(parlnum, 0))
363+
let ind = s:InMultiVarStatement(parlnum, 0, 0)|| s:LineHasOpeningBrackets(parlnum) !~ '2' ?
364+
\ indent(parlnum) : indent(s:GetMSL(parlnum, 0))
365365
endif
366366
endwhile
367367
return ind

0 commit comments

Comments
 (0)