Skip to content

last actual column #431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 12, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions indent/javascript.vim
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function s:Onescope(lnum)
end
let mypos = col('.')
call cursor(a:lnum, 1)
if search('\<\%(while\|for\|if\)\>\s*(', 'ce', a:lnum) > 0 && searchpair('(', '', ')', 'W', s:skip_expr, a:lnum) > 0 && col('.') + 1 == col('$')
if search('\<\%(while\|for\|if\)\>\s*(', 'ce', a:lnum) > 0 && searchpair('(', '', ')', 'W', s:skip_expr, a:lnum) > 0 && col('.') == strlen(s:RemoveTrailingComments(getline(a:lnum)))
call cursor(a:lnum, mypos)
return 1
else
Expand Down Expand Up @@ -189,7 +189,7 @@ endfunction
function s:RemoveTrailingComments(content)
let single = '\/\/\(.*\)\s*$'
let multi = '\/\*\(.*\)\*\/\s*$'
return substitute(substitute(a:content, single, '', ''), multi, '', '')
return substitute(substitute(substitute(a:content, single, '', ''), multi, '', ''), '\s\+$', '', '')
endfunction

" Find if the string is inside var statement (but not the first string)
Expand Down