@@ -212,23 +212,27 @@ function GetJavascriptIndent()
212212 let [s: looksyn ,s: free ] = [v: lnum - 1 ,1 ]
213213 if b: js_cache [0 ] >= l: lnum && b: js_cache [0 ] < v: lnum &&
214214 \ (b: js_cache [0 ] > l: lnum || idx < 0 && s: Balanced (l: lnum ))
215- let num = b: js_cache [1 ]
215+ call call ( ' cursor ' , b: js_cache [1 :])
216216 elseif idx + 1
217- return indent ( s: GetPair ([' \[' ,' (' ,' {' ][idx], ' ])}' [idx],' bW' ,' s:skip_func(s:looksyn)' ,2000 ) )
217+ call s: GetPair ([' \[' ,' (' ,' {' ][idx], ' ])}' [idx],' bW' ,' s:skip_func(s:looksyn)' ,2000 )
218218 elseif indent (v: lnum ) && syns = ~? ' block'
219- let num = s: GetPair (' {' ,' }' ,' bW' ,' s:skip_func(s:looksyn)' ,2000 )
219+ call s: GetPair (' {' ,' }' ,' bW' ,' s:skip_func(s:looksyn)' ,2000 )
220220 else
221- let num = s: GetPair (' [({[]' ,' [])}]' ,' bW' ,' s:skip_func(s:looksyn)' ,2000 )
221+ call s: GetPair (' [({[]' ,' [])}]' ,' bW' ,' s:skip_func(s:looksyn)' ,2000 )
222222 endif
223223 else
224- let num = s: GetPair (' [({[]' ,' [])}]' ,' bW' ,s: skip_expr ,200 ,l: lnum )
224+ call s: GetPair (' [({[]' ,' [])}]' ,' bW' ,s: skip_expr ,200 ,l: lnum )
225225 endif
226226
227227 if idx + 1
228- return indent (num)
228+ if idx == 2 && search (' \S' ,' bW' ,line (' .' )) && getline (' .' )[col (' .' )-1 ] == ' )'
229+ call s: GetPair (' (' ,' )' ,' bW' ,s: skip_expr ,200 )
230+ endif
231+ return indent (line (' .' ))
229232 endif
230- let num = max ([num,0 ])
231- let b: js_cache = [v: lnum ,num,line (' .' ) == v: lnum && num ? b: js_cache [2 ] : col (' .' )]
233+
234+ let b: js_cache = [v: lnum ] + (line (' .' ) == v: lnum ? [0 ,0 ] : [line (' .' ),col (' .' )])
235+ let num = b: js_cache [1 ]
232236
233237 call cursor (v: lnum ,1 )
234238 if l: line = ~# ' ^while\>' && s: GetPair (' \C\<do\>' ,' \C\<while\>' ,' bW' ,s: skip_expr . ' || !s:IsBlock()' ,100 ,num + 1 ) > 0
0 commit comments