Apparently prompt toolkit can not express control-enter?

This commit is contained in:
Paul Gauthier 2023-07-16 14:26:49 -03:00
parent dbf3b09c06
commit e7f35e2cf7
2 changed files with 4 additions and 5 deletions

View file

@ -5,10 +5,9 @@ from pathlib import Path
from prompt_toolkit.completion import Completer, Completion
from prompt_toolkit.history import FileHistory
from prompt_toolkit.key_binding import KeyBindings
from prompt_toolkit.lexers import PygmentsLexer
from prompt_toolkit.shortcuts import CompleteStyle, PromptSession, prompt
from prompt_toolkit.keys import Keys
from prompt_toolkit.key_binding import KeyBindings
from prompt_toolkit.styles import Style
from pygments.lexers import MarkdownLexer, guess_lexer_for_filename
from pygments.token import Token
@ -207,9 +206,9 @@ class InputOutput:
kb = KeyBindings()
@kb.add(Keys.ControlM, eager=True)
@kb.add("escape", "c-m", eager=True)
def _(event):
event.current_buffer.insert_text('\n')
event.current_buffer.insert_text("\n")
session = PromptSession(key_bindings=kb, **session_kwargs)
line = session.prompt()