@@ -199,7 +199,7 @@ function GetJavascriptIndent()
199
199
return -1
200
200
endif
201
201
let l: lnum = s: PrevCodeLine (v: lnum - 1 )
202
- if l: lnum == 0
202
+ if ! l: lnum
203
203
return 0
204
204
endif
205
205
@@ -215,15 +215,14 @@ function GetJavascriptIndent()
215
215
216
216
" the containing paren, bracket, curly. Many hacks for performance
217
217
call cursor (v: lnum ,1 )
218
- let fclose = l: line = ~ ' ^[])}] '
218
+ let idx = stridx ( ' ])} ' , l: line[ 0 ])
219
219
if indent (l: lnum )
220
220
let [s: looksyn ,s: free ] = [v: lnum - 1 ,1 ]
221
221
if b: js_cache [0 ] >= l: lnum && b: js_cache [0 ] < v: lnum &&
222
- \ (b: js_cache [0 ] > l: lnum || ! fclose && s: Balanced (l: lnum ))
222
+ \ (b: js_cache [0 ] > l: lnum || idx < 0 && s: Balanced (l: lnum ))
223
223
let num = b: js_cache [1 ]
224
- elseif fclose
225
- let id = stridx (' ])}' ,l: line [0 ])
226
- return indent (s: GetPair (escape (' [({' [id],' [' ), ' ])}' [id],' bW' ,' s:skip_func(s:looksyn)' ,2000 ))
224
+ elseif idx + 1
225
+ return indent (s: GetPair (escape (' [({' [idx],' [' ), ' ])}' [idx],' bW' ,' s:skip_func(s:looksyn)' ,2000 ))
227
226
elseif indent (v: lnum ) && syns = ~? ' block'
228
227
let num = s: GetPair (' {' ,' }' ,' bW' ,' s:skip_func(s:looksyn)' ,2000 )
229
228
else
@@ -233,7 +232,7 @@ function GetJavascriptIndent()
233
232
let num = s: GetPair (' [({[]' ,' [])}]' ,' bW' ,s: skip_expr ,200 ,l: lnum )
234
233
endif
235
234
236
- if fclose
235
+ if idx + 1
237
236
return indent (num)
238
237
endif
239
238
let num = max ([num,0 ])
0 commit comments