Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

EasyMotion 更新: 合并 mattn 的双宽度字符补丁

  • Loading branch information...
commit 60d6091d8cd5127ae8524cf256b229b76ec95800 1 parent 07986f1
@lilydjwg authored
Showing with 4 additions and 12 deletions.
  1. +4 −12 autoload/EasyMotion/EasyMotion.vim
View
16 autoload/EasyMotion/EasyMotion.vim
@@ -316,7 +316,7 @@
if ! has_key(lines, line_num)
let current_line = getline(line_num)
- let lines[line_num] = { 'orig': current_line, 'marker': current_line, 'mb_compensation': 0 }
+ let lines[line_num] = { 'orig': current_line, 'marker': current_line }
endif
" Compensate for byte difference between marker
@@ -325,16 +325,12 @@
" This has to be done in order to match the correct
" column; \%c matches the byte column and not display
" column.
- let target_char_len = strlen(matchstr(lines[line_num]['marker'], '\%' . col_num . 'c.'))
- let target_key_len = strlen(target_key)
-
- " Solve multibyte issues by matching the byte column
- " number instead of the visual column
- let col_num -= lines[line_num]['mb_compensation']
+ let target_char_len = strdisplaywidth(matchstr(lines[line_num]['marker'], '\%' . col_num . 'c.'))
+ let target_key_len = strdisplaywidth(target_key)
if strlen(lines[line_num]['marker']) > 0
" Substitute marker character if line length > 0
- let lines[line_num]['marker'] = substitute(lines[line_num]['marker'], '\%' . col_num . 'c.', target_key, '')
+ let lines[line_num]['marker'] = substitute(lines[line_num]['marker'], '\%' . col_num . 'c.', target_key . repeat(' ', target_char_len - target_key_len), '')
else
" Set the line to the marker character if the line is empty
let lines[line_num]['marker'] = target_key
@@ -342,10 +338,6 @@
" Add highlighting coordinates
call add(hl_coords, '\%' . line_num . 'l\%' . col_num . 'c')
-
- " Add marker/target lenght difference for multibyte
- " compensation
- let lines[line_num]['mb_compensation'] += (target_char_len - target_key_len)
endfor
let lines_items = items(lines)
Please sign in to comment.
Something went wrong with that request. Please try again.