Skip to content

Commit 8ea46f3

Browse files
authored
neater/faster iterating
1 parent 6ccc1a7 commit 8ea46f3

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

indent/javascript.vim

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -258,17 +258,12 @@ function s:PrevCodeLine(lnum)
258258
let l:pos = getpos('.')
259259
call cursor(l:n,1)
260260
let l:n = search('\m\/\*','bW')
261-
try
262-
while search('\m\/\*\|\(\*\/\)','bWp') == 1
263-
for l:i in range(l:n,line('.'),-1)
264-
if s:SynAt(l:i,l:i == line('.') ? col('.') : 1) !~? s:syng_com
265-
throw 'to main loop'
266-
endif
267-
endfor
268-
let l:n = line('.')
269-
endwhile
270-
catch
271-
endtry
261+
while l:n == line('.') && search('\m\/\*\|\(\*\/\)','bWp') == 1
262+
" /*\n/*\n */ comment region
263+
let l:n = filter(range(l:n, line('.'), -1),
264+
\ 'v:val == line(".") || !empty(getline(v:val)) &&'.
265+
\ 's:SynAt(v:val,1) !~? s:syng_com && {}')[0]
266+
endwhile
272267
call setpos('.',l:pos)
273268
else
274269
break

0 commit comments

Comments
 (0)