Convert buffer name to unicode

Fix JumpToLocation tests on Python 2.
This commit is contained in:
micbou 2016-10-27 18:23:20 +02:00
parent e5457affd8
commit e573457563
No known key found for this signature in database
GPG Key ID: C7E8FD1F3BDA1E05

View File

@ -152,7 +152,7 @@ def BufferIsVisible( buffer_number ):
def GetBufferFilepath( buffer_object ): def GetBufferFilepath( buffer_object ):
if buffer_object.name: if buffer_object.name:
return buffer_object.name return ToUnicode( buffer_object.name )
# Buffers that have just been created by a command like :enew don't have any # Buffers that have just been created by a command like :enew don't have any
# buffer name so we use the buffer number for that. # buffer name so we use the buffer number for that.
return os.path.join( GetCurrentDirectory(), str( buffer_object.number ) ) return os.path.join( GetCurrentDirectory(), str( buffer_object.number ) )
@ -372,7 +372,7 @@ def TryJumpLocationInOpenedTab( filename, line, column ):
for tab in vim.tabpages: for tab in vim.tabpages:
for win in tab.windows: for win in tab.windows:
if win.buffer.name == filepath: if GetBufferFilepath( win.buffer ) == filepath:
vim.current.tabpage = tab vim.current.tabpage = tab
vim.current.window = win vim.current.window = win
vim.current.window.cursor = ( line, column - 1 ) vim.current.window.cursor = ( line, column - 1 )