|
@@ -1680,8 +1680,6 @@ def InsertNamespace_append_test( vim_current, *args ):
|
|
|
AssertBuffersAreEqualAsBytes( expected_buffer, vim_current.buffer )
|
|
|
|
|
|
|
|
|
-@patch( 'ycmd.user_options_store._USER_OPTIONS',
|
|
|
- { 'goto_buffer_command': 'same-buffer' } )
|
|
|
@patch( 'vim.command', new_callable = ExtendedMock )
|
|
|
def JumpToLocation_SameFile_SameBuffer_NoSwapFile_test( vim_command ):
|
|
|
# No 'u' prefix for the current buffer name string to simulate Vim returning
|
|
@@ -1691,7 +1689,8 @@ def JumpToLocation_SameFile_SameBuffer_NoSwapFile_test( vim_command ):
|
|
|
vimsupport.JumpToLocation( os.path.realpath( u'uni¢𐍈d€' ),
|
|
|
2,
|
|
|
5,
|
|
|
- 'aboveleft' )
|
|
|
+ 'aboveleft',
|
|
|
+ 'same-buffer' )
|
|
|
|
|
|
assert_that( vim.current.window.cursor, equal_to( ( 2, 4 ) ) )
|
|
|
vim_command.assert_has_exact_calls( [
|
|
@@ -1700,15 +1699,13 @@ def JumpToLocation_SameFile_SameBuffer_NoSwapFile_test( vim_command ):
|
|
|
] )
|
|
|
|
|
|
|
|
|
-@patch( 'ycmd.user_options_store._USER_OPTIONS',
|
|
|
- { 'goto_buffer_command': 'same-buffer' } )
|
|
|
@patch( 'vim.command', new_callable = ExtendedMock )
|
|
|
def JumpToLocation_DifferentFile_SameBuffer_Unmodified_test( vim_command ):
|
|
|
current_buffer = VimBuffer( 'uni¢𐍈d€' )
|
|
|
with MockVimBuffers( [ current_buffer ], [ current_buffer ] ) as vim:
|
|
|
target_name = os.path.realpath( u'different_uni¢𐍈d€' )
|
|
|
|
|
|
- vimsupport.JumpToLocation( target_name, 2, 5, 'belowright' )
|
|
|
+ vimsupport.JumpToLocation( target_name, 2, 5, 'belowright', 'same-buffer' )
|
|
|
|
|
|
assert_that( vim.current.window.cursor, equal_to( ( 2, 4 ) ) )
|
|
|
vim_command.assert_has_exact_calls( [
|
|
@@ -1718,8 +1715,6 @@ def JumpToLocation_DifferentFile_SameBuffer_Unmodified_test( vim_command ):
|
|
|
] )
|
|
|
|
|
|
|
|
|
-@patch( 'ycmd.user_options_store._USER_OPTIONS',
|
|
|
- { 'goto_buffer_command': 'same-buffer' } )
|
|
|
@patch( 'vim.command', new_callable = ExtendedMock )
|
|
|
def JumpToLocation_DifferentFile_SameBuffer_Modified_CannotHide_test(
|
|
|
vim_command ):
|
|
@@ -1728,7 +1723,7 @@ def JumpToLocation_DifferentFile_SameBuffer_Modified_CannotHide_test(
|
|
|
with MockVimBuffers( [ current_buffer ], [ current_buffer ] ) as vim:
|
|
|
target_name = os.path.realpath( u'different_uni¢𐍈d€' )
|
|
|
|
|
|
- vimsupport.JumpToLocation( target_name, 2, 5, 'botright' )
|
|
|
+ vimsupport.JumpToLocation( target_name, 2, 5, 'botright', 'same-buffer' )
|
|
|
|
|
|
assert_that( vim.current.window.cursor, equal_to( ( 2, 4 ) ) )
|
|
|
vim_command.assert_has_exact_calls( [
|
|
@@ -1738,8 +1733,6 @@ def JumpToLocation_DifferentFile_SameBuffer_Modified_CannotHide_test(
|
|
|
] )
|
|
|
|
|
|
|
|
|
-@patch( 'ycmd.user_options_store._USER_OPTIONS',
|
|
|
- { 'goto_buffer_command': 'same-buffer' } )
|
|
|
@patch( 'vim.command', new_callable = ExtendedMock )
|
|
|
def JumpToLocation_DifferentFile_SameBuffer_Modified_CanHide_test(
|
|
|
vim_command ):
|
|
@@ -1748,7 +1741,7 @@ def JumpToLocation_DifferentFile_SameBuffer_Modified_CanHide_test(
|
|
|
with MockVimBuffers( [ current_buffer ], [ current_buffer ] ) as vim:
|
|
|
target_name = os.path.realpath( u'different_uni¢𐍈d€' )
|
|
|
|
|
|
- vimsupport.JumpToLocation( target_name, 2, 5, 'leftabove' )
|
|
|
+ vimsupport.JumpToLocation( target_name, 2, 5, 'leftabove', 'same-buffer' )
|
|
|
|
|
|
assert_that( vim.current.window.cursor, equal_to( ( 2, 4 ) ) )
|
|
|
vim_command.assert_has_exact_calls( [
|
|
@@ -1758,8 +1751,6 @@ def JumpToLocation_DifferentFile_SameBuffer_Modified_CanHide_test(
|
|
|
] )
|
|
|
|
|
|
|
|
|
-@patch( 'ycmd.user_options_store._USER_OPTIONS',
|
|
|
- { 'goto_buffer_command': 'same-buffer' } )
|
|
|
@patch( 'vim.command',
|
|
|
side_effect = [ None, VimError( 'Unknown code' ), None ] )
|
|
|
def JumpToLocation_DifferentFile_SameBuffer_SwapFile_Unexpected_test(
|
|
@@ -1769,13 +1760,15 @@ def JumpToLocation_DifferentFile_SameBuffer_SwapFile_Unexpected_test(
|
|
|
with MockVimBuffers( [ current_buffer ], [ current_buffer ] ):
|
|
|
assert_that(
|
|
|
calling( vimsupport.JumpToLocation ).with_args(
|
|
|
- os.path.realpath( u'different_uni¢𐍈d€' ), 2, 5, 'rightbelow' ),
|
|
|
+ os.path.realpath( u'different_uni¢𐍈d€' ),
|
|
|
+ 2,
|
|
|
+ 5,
|
|
|
+ 'rightbelow',
|
|
|
+ 'same-buffer' ),
|
|
|
raises( VimError, 'Unknown code' )
|
|
|
)
|
|
|
|
|
|
|
|
|
-@patch( 'ycmd.user_options_store._USER_OPTIONS',
|
|
|
- { 'goto_buffer_command': 'same-buffer' } )
|
|
|
@patch( 'vim.command',
|
|
|
new_callable = ExtendedMock,
|
|
|
side_effect = [ None, VimError( 'E325' ), None ] )
|
|
@@ -1784,7 +1777,7 @@ def JumpToLocation_DifferentFile_SameBuffer_SwapFile_Quit_test( vim_command ):
|
|
|
with MockVimBuffers( [ current_buffer ], [ current_buffer ] ):
|
|
|
target_name = os.path.realpath( u'different_uni¢𐍈d€' )
|
|
|
|
|
|
- vimsupport.JumpToLocation( target_name, 2, 5, 'topleft' )
|
|
|
+ vimsupport.JumpToLocation( target_name, 2, 5, 'topleft', 'same-buffer' )
|
|
|
|
|
|
vim_command.assert_has_exact_calls( [
|
|
|
call( 'normal! m\'' ),
|
|
@@ -1792,8 +1785,6 @@ def JumpToLocation_DifferentFile_SameBuffer_SwapFile_Quit_test( vim_command ):
|
|
|
] )
|
|
|
|
|
|
|
|
|
-@patch( 'ycmd.user_options_store._USER_OPTIONS',
|
|
|
- { 'goto_buffer_command': 'same-buffer' } )
|
|
|
@patch( 'vim.command',
|
|
|
new_callable = ExtendedMock,
|
|
|
side_effect = [ None, KeyboardInterrupt, None ] )
|
|
@@ -1802,7 +1793,7 @@ def JumpToLocation_DifferentFile_SameBuffer_SwapFile_Abort_test( vim_command ):
|
|
|
with MockVimBuffers( [ current_buffer ], [ current_buffer ] ):
|
|
|
target_name = os.path.realpath( u'different_uni¢𐍈d€' )
|
|
|
|
|
|
- vimsupport.JumpToLocation( target_name, 2, 5, 'vertical' )
|
|
|
+ vimsupport.JumpToLocation( target_name, 2, 5, 'vertical', 'same-buffer' )
|
|
|
|
|
|
vim_command.assert_has_exact_calls( [
|
|
|
call( 'normal! m\'' ),
|
|
@@ -1810,8 +1801,6 @@ def JumpToLocation_DifferentFile_SameBuffer_SwapFile_Abort_test( vim_command ):
|
|
|
] )
|
|
|
|
|
|
|
|
|
-@patch( 'ycmd.user_options_store._USER_OPTIONS',
|
|
|
- { 'goto_buffer_command': 'split-or-existing-window' } )
|
|
|
@patch( 'vim.command', new_callable = ExtendedMock )
|
|
|
def JumpToLocation_DifferentFile_Split_CurrentTab_NotAlreadyOpened_test(
|
|
|
vim_command ):
|
|
@@ -1824,7 +1813,11 @@ def JumpToLocation_DifferentFile_Split_CurrentTab_NotAlreadyOpened_test(
|
|
|
|
|
|
target_name = os.path.realpath( u'different_uni¢𐍈d€' )
|
|
|
|
|
|
- vimsupport.JumpToLocation( target_name, 2, 5, 'aboveleft' )
|
|
|
+ vimsupport.JumpToLocation( target_name,
|
|
|
+ 2,
|
|
|
+ 5,
|
|
|
+ 'aboveleft',
|
|
|
+ 'split-or-existing-window' )
|
|
|
|
|
|
vim_command.assert_has_exact_calls( [
|
|
|
call( 'normal! m\'' ),
|
|
@@ -1833,8 +1826,6 @@ def JumpToLocation_DifferentFile_Split_CurrentTab_NotAlreadyOpened_test(
|
|
|
] )
|
|
|
|
|
|
|
|
|
-@patch( 'ycmd.user_options_store._USER_OPTIONS',
|
|
|
- { 'goto_buffer_command': 'split-or-existing-window' } )
|
|
|
@patch( 'vim.command', new_callable = ExtendedMock )
|
|
|
def JumpToLocation_DifferentFile_Split_CurrentTab_AlreadyOpened_test(
|
|
|
vim_command ):
|
|
@@ -1849,7 +1840,10 @@ def JumpToLocation_DifferentFile_Split_CurrentTab_AlreadyOpened_test(
|
|
|
vim.current.tabpage = current_tab
|
|
|
|
|
|
vimsupport.JumpToLocation( os.path.realpath( u'different_uni¢𐍈d€' ),
|
|
|
- 2, 5, 'belowright' )
|
|
|
+ 2,
|
|
|
+ 5,
|
|
|
+ 'belowright',
|
|
|
+ 'split-or-existing-window' )
|
|
|
|
|
|
assert_that( vim.current.tabpage, equal_to( current_tab ) )
|
|
|
assert_that( vim.current.window, equal_to( different_window ) )
|
|
@@ -1860,8 +1854,6 @@ def JumpToLocation_DifferentFile_Split_CurrentTab_AlreadyOpened_test(
|
|
|
] )
|
|
|
|
|
|
|
|
|
-@patch( 'ycmd.user_options_store._USER_OPTIONS',
|
|
|
- { 'goto_buffer_command': 'split-or-existing-window' } )
|
|
|
@patch( 'vim.command', new_callable = ExtendedMock )
|
|
|
def JumpToLocation_DifferentFile_Split_AllTabs_NotAlreadyOpened_test(
|
|
|
vim_command ):
|
|
@@ -1870,7 +1862,11 @@ def JumpToLocation_DifferentFile_Split_AllTabs_NotAlreadyOpened_test(
|
|
|
with MockVimBuffers( [ current_buffer ], [ current_buffer ] ):
|
|
|
target_name = os.path.realpath( u'different_uni¢𐍈d€' )
|
|
|
|
|
|
- vimsupport.JumpToLocation( target_name, 2, 5, 'tab' )
|
|
|
+ vimsupport.JumpToLocation( target_name,
|
|
|
+ 2,
|
|
|
+ 5,
|
|
|
+ 'tab',
|
|
|
+ 'split-or-existing-window' )
|
|
|
|
|
|
vim_command.assert_has_exact_calls( [
|
|
|
call( 'normal! m\'' ),
|
|
@@ -1879,8 +1875,6 @@ def JumpToLocation_DifferentFile_Split_AllTabs_NotAlreadyOpened_test(
|
|
|
] )
|
|
|
|
|
|
|
|
|
-@patch( 'ycmd.user_options_store._USER_OPTIONS',
|
|
|
- { 'goto_buffer_command': 'split-or-existing-window' } )
|
|
|
@patch( 'vim.command', new_callable = ExtendedMock )
|
|
|
def JumpToLocation_DifferentFile_Split_AllTabs_AlreadyOpened_test(
|
|
|
vim_command ):
|
|
@@ -1894,7 +1888,10 @@ def JumpToLocation_DifferentFile_Split_AllTabs_AlreadyOpened_test(
|
|
|
with MockVimBuffers( [ current_buffer, different_buffer ],
|
|
|
[ current_buffer ] ) as vim:
|
|
|
vimsupport.JumpToLocation( os.path.realpath( u'different_uni¢𐍈d€' ),
|
|
|
- 2, 5, 'tab' )
|
|
|
+ 2,
|
|
|
+ 5,
|
|
|
+ 'tab',
|
|
|
+ 'split-or-existing-window' )
|
|
|
|
|
|
assert_that( vim.current.tabpage, equal_to( current_tab ) )
|
|
|
assert_that( vim.current.window, equal_to( different_window ) )
|
|
@@ -1905,8 +1902,6 @@ def JumpToLocation_DifferentFile_Split_AllTabs_AlreadyOpened_test(
|
|
|
] )
|
|
|
|
|
|
|
|
|
-@patch( 'ycmd.user_options_store._USER_OPTIONS',
|
|
|
- { 'goto_buffer_command': 'new-or-existing-tab' } )
|
|
|
@patch( 'vim.command', new_callable = ExtendedMock )
|
|
|
def JumpToLocation_DifferentFile_NewOrExistingTab_NotAlreadyOpened_test(
|
|
|
vim_command ):
|
|
@@ -1915,7 +1910,11 @@ def JumpToLocation_DifferentFile_NewOrExistingTab_NotAlreadyOpened_test(
|
|
|
with MockVimBuffers( [ current_buffer ], [ current_buffer ] ):
|
|
|
target_name = os.path.realpath( u'different_uni¢𐍈d€' )
|
|
|
|
|
|
- vimsupport.JumpToLocation( target_name, 2, 5, 'aboveleft vertical' )
|
|
|
+ vimsupport.JumpToLocation( target_name,
|
|
|
+ 2,
|
|
|
+ 5,
|
|
|
+ 'aboveleft vertical',
|
|
|
+ 'new-or-existing-tab' )
|
|
|
|
|
|
vim_command.assert_has_exact_calls( [
|
|
|
call( 'normal! m\'' ),
|
|
@@ -1924,8 +1923,6 @@ def JumpToLocation_DifferentFile_NewOrExistingTab_NotAlreadyOpened_test(
|
|
|
] )
|
|
|
|
|
|
|
|
|
-@patch( 'ycmd.user_options_store._USER_OPTIONS',
|
|
|
- { 'goto_buffer_command': 'new-or-existing-tab' } )
|
|
|
@patch( 'vim.command', new_callable = ExtendedMock )
|
|
|
def JumpToLocation_DifferentFile_NewOrExistingTab_AlreadyOpened_test(
|
|
|
vim_command ):
|
|
@@ -1939,7 +1936,10 @@ def JumpToLocation_DifferentFile_NewOrExistingTab_AlreadyOpened_test(
|
|
|
with MockVimBuffers( [ current_buffer, different_buffer ],
|
|
|
[ current_buffer ] ) as vim:
|
|
|
vimsupport.JumpToLocation( os.path.realpath( u'different_uni¢𐍈d€' ),
|
|
|
- 2, 5, 'belowright tab' )
|
|
|
+ 2,
|
|
|
+ 5,
|
|
|
+ 'belowright tab',
|
|
|
+ 'new-or-existing-tab' )
|
|
|
|
|
|
assert_that( vim.current.tabpage, equal_to( current_tab ) )
|
|
|
assert_that( vim.current.window, equal_to( different_window ) )
|