fix tabpage errors

This commit is contained in:
Ben Jackson 2019-07-04 00:16:39 +01:00
commit cee10c8187
5 changed files with 97 additions and 29 deletions

View file

@ -147,11 +147,13 @@ def RestoreCursorPosition():
@contextlib.contextmanager
def RestoreCurrentWindow():
# TODO: Don't trigger autoccommands when shifting windows
# TODO: Don't trigger autocommands when shifting windows
old_tabpage = vim.current.tabpage
old_window = vim.current.window
try:
yield
finally:
vim.current.tabpage = old_tabpage
vim.current.window = old_window
@ -167,6 +169,18 @@ def RestoreCurrentBuffer( window ):
vim.current.buffer = old_buffer
@contextlib.contextmanager
def LetCurrentWindow( window ):
with RestoreCurrentWindow():
JumpToWindow( window )
yield
def JumpToWindow( window ):
vim.current.tabpage = window.tabpage
vim.current.window = window
@contextlib.contextmanager
def TemporaryVimOptions( opts ):
old_value = {}