Improve visual selection handling

This commit is contained in:
Kim Silkebækken 2011-03-29 17:03:46 +02:00
parent b70c94403d
commit fea0d68d5a

View File

@ -343,25 +343,15 @@
let coords = s:PromptUser(groups)
if ! empty(a:visualmode)
" Store original marks
let m_a = getpos("'a")
let m_b = getpos("'b")
" Store start/end positions
call setpos("'a", [0, orig_pos[0], orig_pos[1]])
call setpos("'b", [0, coords[0], coords[1]])
" Update selection
silent exec 'normal! `a' . a:visualmode . '`b'
call setpos('.', [0, orig_pos[0], orig_pos[1]])
" Restore original marks
call setpos("'a", m_a)
call setpos("'b", m_b)
else
" Update cursor position
call setpos('.', [0, coords[0], coords[1]])
exec 'normal! ' . a:visualmode
endif
" Update cursor position
call setpos('.', [0, coords[0], coords[1]])
call s:Message('Jumping to [' . coords[0] . ', ' . coords[1] . ']')
catch /.*/
redraw