Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/mcp_agent/core/enhanced_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,14 @@ def _(event) -> None:
"""Enter: accept input when not in multiline mode."""
event.current_buffer.validate_and_handle()

@kb.add("c-j", filter=Condition(lambda: not in_multiline_mode))
def _(event) -> None:
"""Ctrl+J: Insert newline when in normal mode."""
event.current_buffer.insert_text("\n")

@kb.add("c-m", filter=Condition(lambda: in_multiline_mode))
def _(event) -> None:
"""Enter: insert newline when in multiline mode."""
"""Enter: Insert newline when in multiline mode."""
event.current_buffer.insert_text("\n")

# Use c-j (Ctrl+J) as an alternative to represent Ctrl+Enter in multiline mode
Expand Down Expand Up @@ -581,14 +586,15 @@ def get_toolbar():

shortcuts = [
("Ctrl+T", toggle_text),
("Ctrl+J", "Newline" if not in_multiline_mode else None),
("Ctrl+E", "External"),
("Ctrl+Y", "Copy"),
("Ctrl+L", "Clear"),
("↑/↓", "History"),
("EXIT", "Exit")
]

newline = "Ctrl+<Enter>:Submit" if in_multiline_mode else "<Enter>:Submit"
newline = "Ctrl+J:Submit" if in_multiline_mode else "<Enter>:Submit"

# Only show relevant shortcuts based on mode
shortcuts = [(k, v) for k, v in shortcuts if v]
Expand Down Expand Up @@ -670,6 +676,8 @@ def get_toolbar():
def pre_process_input(text):
# Command processing
if text and text.startswith("/"):
if text == "/":
return ""
cmd_parts = text[1:].strip().split(maxsplit=1)
cmd = cmd_parts[0].lower()

Expand Down
Loading