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

[RFC] Fix issue #25 #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
9 changes: 2 additions & 7 deletions autoload/asterisk.vim
Original file line number Diff line number Diff line change
Expand Up @@ -153,25 +153,20 @@ function! s:convert_2_word_pattern_4_visual(pattern, config) abort
let [pre, post] = ['', '']
if a:config.is_whole
let [head_pos, tail_pos] = s:sort_pos([s:getcoord('.'), s:getcoord('v')])
let head = matchstr(text, '^.')
let is_head_multibyte = 1 < len(head)
let [l, col] = head_pos
let line = getline(l)
let before = line[: col - 2]
let outer = matchstr(before, '.$')
if text =~# '^\k' && ((!empty(outer) && len(outer) != len(head)) ||
\ (!is_head_multibyte && (col == 1 || before !~# '\k$')))
if text =~# '^\k' && outer !~# '\k'
let pre = '\<'
endif
let tail = matchstr(text, '.$')
let is_tail_multibyte = 1 < len(tail)
let [l, col] = tail_pos
let col += s:is_exclusive() && head_pos[1] !=# tail_pos[1] ? - 1 : len(tail) - 1
let line = getline(l)
let after = line[col :]
let outer = matchstr(after, '^.')
if text =~# '\k$' && ((!empty(outer) && len(outer) != len(tail)) ||
\ (!is_tail_multibyte && (col == len(line) || after !~# '^\k')))
if text =~# '\k$' && outer !~# '\k'
let post = '\>'
endif
endif
Expand Down