Skip to content

Commit bf12d09

Browse files
Fixed history browser.
1 parent 4901105 commit bf12d09

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

ptpython/history_browser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ def _(event):
506506
@handle('enter', filter=main_buffer_focussed)
507507
def _(event):
508508
" Accept input. "
509-
event.app.set_return_value(history.default_buffer.document)
509+
event.app.set_return_value(history.default_buffer.text)
510510

511511
enable_system_bindings = Condition(lambda: python_input.enable_system_bindings)
512512

ptpython/python_input.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from __future__ import unicode_literals
66

77
from prompt_toolkit.application import Application, get_app
8+
from prompt_toolkit.application.run_in_terminal import run_coroutine_in_terminal
89
from prompt_toolkit.auto_suggest import AutoSuggestFromHistory, ConditionalAutoSuggest, ThreadedAutoSuggest
910
from prompt_toolkit.buffer import Buffer
1011
from prompt_toolkit.completion import ThreadedCompleter
@@ -644,12 +645,13 @@ def enter_history(self):
644645

645646
def done(f):
646647
result = f.result()
648+
assert isinstance(result, str), 'got %r' % (result, )
647649
if result is not None:
648-
self.default_buffer.document = result
650+
self.default_buffer.text = result
649651

650652
app.vi_state.input_mode = InputMode.INSERT
651653

652654
history = History(self, self.default_buffer.document)
653655

654-
future = app.run_in_terminal_async(history.app.run_async)
656+
future = run_coroutine_in_terminal(history.app.run_async)
655657
future.add_done_callback(done)

0 commit comments

Comments
 (0)