@@ -1375,7 +1375,7 @@ def test_ReplaceChunks_MultiFile_Open( self,
13751375 def test_WriteToPreviewWindow ( self , vim_current , vim_command ):
13761376 vim_current .window .options .__getitem__ = MagicMock ( return_value = True )
13771377
1378- vimsupport .WriteToPreviewWindow ( "test" )
1378+ vimsupport .WriteToPreviewWindow ( "test" , '' )
13791379
13801380 vim_command .assert_has_exact_calls ( [
13811381 call ( 'silent! pclose!' ),
@@ -1398,11 +1398,39 @@ def test_WriteToPreviewWindow( self, vim_current, vim_command ):
13981398 call ( 'readonly' , True ),
13991399 ], any_order = True )
14001400
1401+ @patch ( 'vim.command' , new_callable = ExtendedMock )
1402+ @patch ( 'vim.current' , new_callable = ExtendedMock )
1403+ def test_WriteToPreviewWindow_Mods ( self , vim_current , vim_command ):
1404+ vim_current .window .options .__getitem__ = MagicMock ( return_value = True )
1405+
1406+ vimsupport .WriteToPreviewWindow ( "test" , 'tab leftabove' )
1407+
1408+ vim_command .assert_has_exact_calls ( [
1409+ call ( 'silent! pclose!' ),
1410+ call ( 'silent! tab leftabove pedit! _TEMP_FILE_' ),
1411+ call ( 'silent! wincmd P' ),
1412+ call ( 'silent! wincmd p' ) ] )
1413+
1414+ vim_current .buffer .__setitem__ .assert_called_with (
1415+ slice ( None , None , None ), [ 'test' ] )
1416+
1417+ vim_current .buffer .options .__setitem__ .assert_has_exact_calls ( [
1418+ call ( 'modifiable' , True ),
1419+ call ( 'readonly' , False ),
1420+ call ( 'buftype' , 'nofile' ),
1421+ call ( 'bufhidden' , 'wipe' ),
1422+ call ( 'buflisted' , False ),
1423+ call ( 'swapfile' , False ),
1424+ call ( 'modifiable' , False ),
1425+ call ( 'modified' , False ),
1426+ call ( 'readonly' , True ),
1427+ ], any_order = True )
1428+
14011429
14021430 @patch ( 'vim.current' )
14031431 def test_WriteToPreviewWindow_MultiLine ( self , vim_current ):
14041432 vim_current .window .options .__getitem__ = MagicMock ( return_value = True )
1405- vimsupport .WriteToPreviewWindow ( "test\n test2" )
1433+ vimsupport .WriteToPreviewWindow ( "test\n test2" , '' )
14061434
14071435 vim_current .buffer .__setitem__ .assert_called_with (
14081436 slice ( None , None , None ), [ 'test' , 'test2' ] )
@@ -1413,7 +1441,7 @@ def test_WriteToPreviewWindow_MultiLine( self, vim_current ):
14131441 def test_WriteToPreviewWindow_JumpFail ( self , vim_current , vim_command ):
14141442 vim_current .window .options .__getitem__ = MagicMock ( return_value = False )
14151443
1416- vimsupport .WriteToPreviewWindow ( "test" )
1444+ vimsupport .WriteToPreviewWindow ( "test" , '' )
14171445
14181446 vim_command .assert_has_exact_calls ( [
14191447 call ( 'silent! pclose!' ),
@@ -1434,7 +1462,7 @@ def test_WriteToPreviewWindow_JumpFail_MultiLine(
14341462
14351463 vim_current .window .options .__getitem__ = MagicMock ( return_value = False )
14361464
1437- vimsupport .WriteToPreviewWindow ( "test\n test2" )
1465+ vimsupport .WriteToPreviewWindow ( "test\n test2" , '' )
14381466
14391467 vim_command .assert_has_exact_calls ( [
14401468 call ( 'silent! pclose!' ),
0 commit comments