Skip to content

Commit b5f6e67

Browse files
committed
bugfix for #318
1 parent 8d9bfb3 commit b5f6e67

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

autoload/easycomplete/popup.vim

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,11 @@ function! s:CurrCharIsChinese()
138138
endfunction
139139

140140
function! s:GetCusorToLineRightEdgeDistance()
141-
let offset = s:CurrCharIsChinese()
142-
return strwidth(getline('.')) - virtcol('.') + 1 + offset
141+
let l:chinese_offset = s:CurrCharIsChinese()
142+
" 要计算当前行的 \t 的数量,根据&tabstop长度补上差的宽度
143+
let l:ts_nr = len(substitute(getline('.'), '[^\t]', '', 'g'))
144+
let l:offset = (&tabstop - 1) * l:ts_nr
145+
return strwidth(getline('.')) + l:offset - virtcol('.') + 1 + l:chinese_offset
143146
endfunction
144147

145148
function! s:lint(content, hl, ft)

0 commit comments

Comments
 (0)