diff --git a/awsshell/app.py b/awsshell/app.py index 84b5660..3ef73a7 100644 --- a/awsshell/app.py +++ b/awsshell/app.py @@ -12,7 +12,7 @@ from prompt_toolkit.document import Document from prompt_toolkit.shortcuts import create_eventloop from prompt_toolkit.buffer import Buffer -from prompt_toolkit.filters import Always +from prompt_toolkit.filters import Always, Condition from prompt_toolkit.interface import CommandLineInterface, Application from prompt_toolkit.interface import AbortAction, AcceptAction from prompt_toolkit.auto_suggest import AutoSuggestFromHistory @@ -344,14 +344,20 @@ def create_layout(self, display_completions_in_columns, toolbar): get_bottom_toolbar_tokens=toolbar.handler) def create_buffer(self, completer, history): - return Buffer( + def is_buffer_multiline(): + return buffer.document.text.endswith('\\') + + buffer = Buffer( history=history, auto_suggest=AutoSuggestFromHistory(), enable_history_search=True, completer=completer, complete_while_typing=Always(), + is_multiline=Condition(is_buffer_multiline), accept_action=AcceptAction.RETURN_DOCUMENT) + return buffer + def create_key_manager(self): """Create the :class:`KeyManager`.