|
71 | 71 | let g:javascript_opfirst = s:line_pre . g:javascript_opfirst |
72 | 72 | let g:javascript_continuation .= s:line_term |
73 | 73 |
|
74 | | -function s:Onescope(lnum,text,add) |
| 74 | +function s:OneScope(lnum,text,add) |
75 | 75 | return a:text =~# '\%(\<else\|\<do\|=>\)' . s:line_term ? 'no b' : |
76 | 76 | \ ((a:add && a:text =~ s:line_pre . '$' && search('\%' . s:PrevCodeLine(a:lnum - 1) . 'l.)' . s:line_term)) || |
77 | 77 | \ cursor(a:lnum, match(a:text, ')' . s:line_term)) > -1) && |
@@ -179,14 +179,14 @@ function GetJavascriptIndent() |
179 | 179 | let pline = s:StripLine(getline(l:lnum)) |
180 | 180 | call cursor(b:js_cache[1],b:js_cache[2]) |
181 | 181 | let inb = num == 0 || num < l:lnum && ((l:line !~ s:line_pre . ',' && pline !~ ',' . s:line_term) || s:IsBlock()) |
182 | | - let switch_offset = num == 0 || s:Onescope(num, s:StripLine(strpart(getline(num),0,b:js_cache[2] - 1)),1) !=# 'switch' ? 0 : |
| 182 | + let switch_offset = num == 0 || s:OneScope(num, s:StripLine(strpart(getline(num),0,b:js_cache[2] - 1)),1) !=# 'switch' ? 0 : |
183 | 183 | \ &cino !~ ':' || !has('float') ? s:sw() : |
184 | 184 | \ float2nr(str2float(matchstr(&cino,'.*:\zs[-0-9.]*')) * (&cino =~# '.*:[^,]*s' ? s:sw() : 1)) |
185 | 185 |
|
186 | 186 | " most significant, find the indent amount |
187 | 187 | if (inb && (l:line =~# g:javascript_opfirst || |
188 | 188 | \ (pline =~# g:javascript_continuation && pline !~# s:expr_case))) || |
189 | | - \ (num < l:lnum && s:Onescope(l:lnum,pline,0) =~# '\%(for\|each\|if\|let\|no\sb\|w\%(hile\|ith\)\)' && |
| 189 | + \ (num < l:lnum && s:OneScope(l:lnum,pline,0) =~# '\%(for\|each\|if\|let\|no\sb\|w\%(hile\|ith\)\)' && |
190 | 190 | \ l:line !~ s:line_pre . '{') |
191 | 191 | return (num > 0 ? indent(num) : -s:sw()) + (s:sw() * 2) + switch_offset |
192 | 192 | elseif num > 0 |
|
0 commit comments