From 3515cb6c1392b446b662f53059ab1ca6d2800435 Mon Sep 17 00:00:00 2001 From: Holger Rapp Date: Fri, 30 Mar 2018 22:02:51 +0200 Subject: [PATCH] Adapt to the new way that tmux wants unicode be send. This fixes most unicode using test-cases. --- test/vim_interface.py | 7 ++++--- test/vim_test_case.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/test/vim_interface.py b/test/vim_interface.py index cecc270..c885589 100644 --- a/test/vim_interface.py +++ b/test/vim_interface.py @@ -172,9 +172,10 @@ class VimInterfaceTmux(VimInterface): # to tmux, but it seems like this is all that is needed for now. s = s.replace(';', r'\;') - if PYTHON3: - s = s.encode('utf-8') - silent_call(['tmux', 'send-keys', '-t', self.session, '-l', s]) + if len(s) == 1: + silent_call(['tmux', 'send-keys', '-t', self.session, hex(ord(s))]) + else: + silent_call(['tmux', 'send-keys', '-t', self.session, '-l', s]) def send_to_terminal(self, s): return self._send(s) diff --git a/test/vim_test_case.py b/test/vim_test_case.py index f3a6e08..b689bbb 100644 --- a/test/vim_test_case.py +++ b/test/vim_test_case.py @@ -185,7 +185,7 @@ class VimTestCase(unittest.TestCase, TempFileManager): if not self.interrupt: # Go into insert mode and type the keys but leave Vim some time to # react. - text = 'i' + self.keys + text = u'i' + self.keys.decode("utf-8") while text: to_send = None for seq in SEQUENCES: