diff --git a/pyrepl/commands.py b/pyrepl/commands.py index af71c70..c121f34 100644 --- a/pyrepl/commands.py +++ b/pyrepl/commands.py @@ -369,8 +369,12 @@ def do(self): class qIHelp(Command): def do(self): + from .reader import disp_str + r = self.reader - r.insert((bytes(self.event) + r.console.getpending().data) * r.get_arg()) + pending = r.console.getpending().data + disp = disp_str((self.event + pending))[0] + r.insert(disp * r.get_arg()) r.pop_input_trans() from pyrepl import input @@ -379,7 +383,7 @@ class QITrans(object): def push(self, evt): self.evt = evt def get(self): - return ('qIHelp', self.evt.raw) + return ('qIHelp', self.evt.data) class quoted_insert(Command): kills_digit_arg = 0 diff --git a/testing/infrastructure.py b/testing/infrastructure.py index c5a4c96..e90298b 100644 --- a/testing/infrastructure.py +++ b/testing/infrastructure.py @@ -55,6 +55,10 @@ def get_event(self, block=1): print("event", ev) return Event(*ev) + def getpending(self): + """Nothing pending, but do not return None here.""" + return Event('key', '', b'') + class TestReader(Reader): __test__ = False diff --git a/testing/test_wishes.py b/testing/test_wishes.py index 650dff7..d0c1e6f 100644 --- a/testing/test_wishes.py +++ b/testing/test_wishes.py @@ -27,5 +27,5 @@ def test_quoted_insert_repeat(): read_spec([ (('digit-arg', '3'), ['']), (('quoted-insert', None), ['']), - (('self-insert', '\033'), ['^[^[^[']), + (('key', '\033'), ['^[^[^[']), (('accept', None), None)])