Skip to content

Commit

Permalink
Fix to use appropriate position to handle multibyte
Browse files Browse the repository at this point in the history
- getpos('.') doesn't always greater than getpos('v')
  • Loading branch information
haya14busa committed Dec 10, 2014
1 parent bbe5f6f commit e4c5391
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions autoload/asterisk.vim
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ function! s:convert_2_word_pattern_4_visual(pattern, config) abort
let type = (a:config.direction is# s:DIRECTION.forward ? '/' : '?')
let [pre, post] = ['', '']
if a:config.is_whole
let [head_pos, tail_pos] = s:sort_pos([getpos('.')[1:2], getpos('v')[1:2]])
let head = matchstr(text, '^.')
let is_head_multibyte = 1 < len(head)
let [l, col] = getpos("v")[1 : 2]
let [l, col] = head_pos
let line = getline(l)
let before = line[: col - 2]
let outer = matchstr(before, '.$')
Expand All @@ -96,7 +97,7 @@ function! s:convert_2_word_pattern_4_visual(pattern, config) abort
endif
let tail = matchstr(text, '.$')
let is_tail_multibyte = 1 < len(tail)
let [l, col] = getpos(".")[1 : 2]
let [l, col] = tail_pos
let col += len(tail) - 1
let line = getline(l)
let after = line[col :]
Expand Down

0 comments on commit e4c5391

Please sign in to comment.