Skip to content

Commit f6cadc1

Browse files
committed
fix virtual col for multibyte JK motion when g:EasyMotion_startofline=0
1 parent 1a0244c commit f6cadc1

File tree

2 files changed

+1
-18
lines changed

2 files changed

+1
-18
lines changed

autoload/EasyMotion.vim

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ function! EasyMotion#JK(visualmode, direction) " {{{
241241
if g:EasyMotion_startofline
242242
call s:EasyMotion('^\(\w\|\s*\zs\|$\)', a:direction, a:visualmode ? visualmode() : '', 0)
243243
else
244-
let vcol = EasyMotion#helper#vcol('.')
244+
let vcol = getcurpos()[4]
245245
let pattern = printf('^.\{-}\zs\(\%%<%dv.\%%>%dv\|$\)', vcol + 1, vcol)
246246
call s:EasyMotion(pattern, a:direction, a:visualmode ? visualmode() : '', 0)
247247
endif

autoload/EasyMotion/helper.vim

-17
Original file line numberDiff line numberDiff line change
@@ -159,23 +159,6 @@ function! EasyMotion#helper#include_multibyte_char(str) "{{{
159159
return strlen(a:str) != EasyMotion#helper#strchars(a:str)
160160
endfunction "}}}
161161

162-
function! EasyMotion#helper#vcol(expr) abort
163-
let col_num = col(a:expr)
164-
let line = getline(a:expr)
165-
let before_line = col_num > 2 ? line[: col_num - 2]
166-
\ : col_num is# 2 ? line[0]
167-
\ : ''
168-
let vcol_num = 1
169-
for c in split(before_line, '\zs')
170-
let vcol_num += c is# "\t" ? s:_virtual_tab2spacelen(vcol_num) : len(c)
171-
endfor
172-
return vcol_num
173-
endfunction
174-
175-
function! s:_virtual_tab2spacelen(col_num) abort
176-
return &tabstop - ((a:col_num - 1) % &tabstop)
177-
endfunction
178-
179162
"}}}
180163

181164
" Restore 'cpoptions' {{{

0 commit comments

Comments
 (0)