@@ -212,23 +212,27 @@ function GetJavascriptIndent()
212
212
let [s: looksyn ,s: free ] = [v: lnum - 1 ,1 ]
213
213
if b: js_cache [0 ] >= l: lnum && b: js_cache [0 ] < v: lnum &&
214
214
\ (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 :])
216
216
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 )
218
218
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 )
220
220
else
221
- let num = s: GetPair (' [({[]' ,' [])}]' ,' bW' ,' s:skip_func(s:looksyn)' ,2000 )
221
+ call s: GetPair (' [({[]' ,' [])}]' ,' bW' ,' s:skip_func(s:looksyn)' ,2000 )
222
222
endif
223
223
else
224
- let num = s: GetPair (' [({[]' ,' [])}]' ,' bW' ,s: skip_expr ,200 ,l: lnum )
224
+ call s: GetPair (' [({[]' ,' [])}]' ,' bW' ,s: skip_expr ,200 ,l: lnum )
225
225
endif
226
226
227
227
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 (' .' ))
229
232
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 ]
232
236
233
237
call cursor (v: lnum ,1 )
234
238
if l: line = ~# ' ^while\>' && s: GetPair (' \C\<do\>' ,' \C\<while\>' ,' bW' ,s: skip_expr . ' || !s:IsBlock()' ,100 ,num + 1 ) > 0
0 commit comments