1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-24 05:20:04 +08:00

Fix cursor

This commit is contained in:
wsdjeg 2018-01-17 00:04:41 +08:00
parent 1decec7ec5
commit bef3aae0a9

View File

@ -256,7 +256,7 @@ function! s:parse_symbol(begin, end, symbol) abort
endif endif
let s:symbol_cursor = line[ cursor[1] - 1 : cursor[1] - 1] let s:symbol_cursor = line[ cursor[1] - 1 : cursor[1] - 1]
if pos_c + 1 + len > cursor[1] if pos_c + 1 + len > cursor[1]
let s:symbol_end = line[ cursor[1] : pos_c + len] let s:symbol_end = line[ cursor[1] : pos_c + len - 1]
else else
let s:symbol_end = '' let s:symbol_end = ''
endif endif
@ -277,7 +277,7 @@ function! s:replace_symbol(symbol) abort
if pos[1] == 1 if pos[1] == 1
let begin = '' let begin = ''
else else
let begin = line[:pos[1]] let begin = line[:pos[1] - 2]
endif endif
let end = line[pos[1] + pos[2]:] let end = line[pos[1] + pos[2]:]
let line = begin . lines[0] . end let line = begin . lines[0] . end
@ -292,9 +292,9 @@ function! s:replace_symbol(symbol) abort
if pos[1] == 1 if pos[1] == 1
let begin = '' let begin = ''
else else
let begin = line[:pos[1]] let begin = line[:pos[1] - 2]
endif endif
let end = line[pos[1] + pos[2]:] let end = line[pos[1] + pos[2] - 1:]
let line = begin . a:symbol . end let line = begin . a:symbol . end
call setline(pos[0], line) call setline(pos[0], line)
let s:stack[len-1-idx][2] = len(a:symbol) let s:stack[len-1-idx][2] = len(a:symbol)