@@ -165,7 +165,7 @@ function s:Balanced(lnum)
165
165
let pos = match (l: line , ' [][(){}]' , 0 )
166
166
while pos != -1
167
167
if synIDattr (synID (a: lnum ,pos + 1 ,0 ),' name' ) !~? s: syng_strcom
168
- if l: line [pos] = ~ ' [{([] '
168
+ if stridx ( ' [({ ' , l: line [pos]) + 1
169
169
let l: open += 1
170
170
else
171
171
let l: open -= 1
@@ -215,14 +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 idx = stridx (' ])}' ,l: line [0 ])
218
+ let idx = strlen ( l: line ) ? stridx (' ])}' ,l: line [0 ]) : -1
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
222
\ (b: js_cache [0 ] > l: lnum || idx < 0 && s: Balanced (l: lnum ))
223
223
let num = b: js_cache [1 ]
224
224
elseif idx + 1
225
- return indent (s: GetPair (escape ( ' [({ ' [idx], ' [ ' ) , ' ])}' [idx],' bW' ,' s:skip_func(s:looksyn)' ,2000 ))
225
+ return indent (s: GetPair ([ ' \[ ' , ' ( ' , ' { ' ] [idx], ' ])}' [idx],' bW' ,' s:skip_func(s:looksyn)' ,2000 ))
226
226
elseif indent (v: lnum ) && syns = ~? ' block'
227
227
let num = s: GetPair (' {' ,' }' ,' bW' ,' s:skip_func(s:looksyn)' ,2000 )
228
228
else
@@ -255,7 +255,7 @@ function GetJavascriptIndent()
255
255
" most significant, find the indent amount
256
256
let isOp = l: line = ~# s: opfirst || pline !~# s: expr_case . ' $' && pline = ~# s: continuation
257
257
let bL = s: iscontOne (l: lnum ,num,isOp)
258
- let bL -= (bL && l: line = ~ ' ^{ ' ) * s: W
258
+ let bL -= (bL && strridx ( l: line, ' { ' , 0 ) + 1 ) * s: W
259
259
if isOp && (! num || bchar && cursor (b: js_cache [1 ],b: js_cache [2 ])+ 1 && s: IsBlock ())
260
260
return (num ? indent (num) : - s: W ) + (s: W * 2 ) + switch_offset + bL
261
261
elseif num
0 commit comments