Skip to content
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

sneak#to: fix imprecise/erroneous comments #272

Merged
merged 1 commit into from
Jul 3, 2021
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
6 changes: 3 additions & 3 deletions plugin/sneak.vim
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func! sneak#to(op, input, inputlen, count, register, repeatmotion, reverse, incl
norm! gv
endif

" [count] means 'skip this many' _only_ for operators/repeat-motion/2-char-search
" [count] means 'skip to this match' _only_ for operators/repeat-motion/1-char-search
" sanity check: max out at 999, to avoid searchpos() OOM.
let skip = (is_op || a:repeatmotion || a:inputlen < 2) ? min([999, a:count]) : 0

Expand All @@ -132,7 +132,7 @@ func! sneak#to(op, input, inputlen, count, register, repeatmotion, reverse, incl
let l:scope_pattern = '' " pattern used to highlight the vertical 'scope'
let l:match_bounds = ''

"scope to a column of width 2*(v:count1) _except_ for operators/repeat-motion/1-char-search
"scope to a column of width 2*(v:count1)+1 _except_ for operators/repeat-motion/1-char-search
if ((!skip && a:count > 1) || max(bounds)) && !is_op
if !max(bounds) "derive bounds from count (_logical_ bounds highlighted in 'scope')
let bounds[0] = max([0, (virtcol('.') - a:count - 1)])
Expand Down Expand Up @@ -212,7 +212,7 @@ func! sneak#to(op, input, inputlen, count, register, repeatmotion, reverse, incl

call s:attach_autocmds()

"highlight actual matches at or below the cursor position
"highlight actual matches at or beyond the cursor position
" - store in w: because matchadd() highlight is per-window.
let w:sneak_hl_id = matchadd('Sneak',
\ (s.prefix).(s.match_pattern).(s.search).'\|'.curln_pattern.(s.search))
Expand Down