mirror of
https://github.com/davidhalter/jedi-vim.git
synced 2025-12-08 03:24:47 +08:00
Fix rename with folds: replace line in buffer directly (#906)
Fixes #789
This commit is contained in:
committed by
Daniel Hahler
parent
c5c13d69d6
commit
ba5915bf26
@@ -52,5 +52,6 @@ Tomoyuki Kashiro (@kashiro)
|
|||||||
Tommy Allen (@tweekmonster)
|
Tommy Allen (@tweekmonster)
|
||||||
Mingliang (@Aulddays)
|
Mingliang (@Aulddays)
|
||||||
Brian Mego (@brianmego)
|
Brian Mego (@brianmego)
|
||||||
|
Stevan Milic (@stevanmilic) <stevan.milic@yahoo.com>
|
||||||
|
|
||||||
@something are github user names.
|
@something are github user names.
|
||||||
|
|||||||
@@ -713,16 +713,10 @@ def do_rename(replace, orig=None):
|
|||||||
|
|
||||||
buffers.add(vim.current.buffer.name)
|
buffers.add(vim.current.buffer.name)
|
||||||
|
|
||||||
# Save view.
|
|
||||||
saved_view = vim_eval('string(winsaveview())')
|
|
||||||
|
|
||||||
# Replace original word.
|
# Replace original word.
|
||||||
vim.current.window.cursor = (r.line, r.column)
|
r_line = vim.current.buffer[r.line - 1]
|
||||||
vim_command('normal! c{0:d}l{1}'.format(len(orig), replace))
|
vim.current.buffer[r.line - 1] = (r_line[:r.column] + replace +
|
||||||
|
r_line[r.column + len(orig):])
|
||||||
# Restore view.
|
|
||||||
vim_command('call winrestview(%s)' % saved_view)
|
|
||||||
highlight_usages([r], length=len(replace))
|
|
||||||
|
|
||||||
# Restore previous tab and window.
|
# Restore previous tab and window.
|
||||||
vim_command('tabnext {0:d}'.format(saved_tab))
|
vim_command('tabnext {0:d}'.format(saved_tab))
|
||||||
|
|||||||
Reference in New Issue
Block a user