Skip to content

Commit

Permalink
Fixed history browser.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanslenders committed Jun 2, 2018
1 parent 4901105 commit bf12d09
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ptpython/history_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ def _(event):
@handle('enter', filter=main_buffer_focussed)
def _(event):
" Accept input. "
event.app.set_return_value(history.default_buffer.document)
event.app.set_return_value(history.default_buffer.text)

enable_system_bindings = Condition(lambda: python_input.enable_system_bindings)

Expand Down
6 changes: 4 additions & 2 deletions ptpython/python_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from __future__ import unicode_literals

from prompt_toolkit.application import Application, get_app
from prompt_toolkit.application.run_in_terminal import run_coroutine_in_terminal
from prompt_toolkit.auto_suggest import AutoSuggestFromHistory, ConditionalAutoSuggest, ThreadedAutoSuggest
from prompt_toolkit.buffer import Buffer
from prompt_toolkit.completion import ThreadedCompleter
Expand Down Expand Up @@ -644,12 +645,13 @@ def enter_history(self):

def done(f):
result = f.result()
assert isinstance(result, str), 'got %r' % (result, )
if result is not None:
self.default_buffer.document = result
self.default_buffer.text = result

app.vi_state.input_mode = InputMode.INSERT

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

future = app.run_in_terminal_async(history.app.run_async)
future = run_coroutine_in_terminal(history.app.run_async)
future.add_done_callback(done)

0 comments on commit bf12d09

Please sign in to comment.