mirror of
https://github.com/langchain-ai/deepagents.git
synced 2026-07-21 17:25:26 -04:00
fix(code): word-delete backspace parity in ask-user text area (#4079)
Fix `ctrl+backspace`/`alt+backspace` word deletion in the ask-user free-text input. --- The ask-user free-text field didn't support `ctrl+backspace`/`alt+backspace` word deletion, unlike the main chat input. This adds the same `delete_word_left` binding to `AskUserTextArea` for input parity. Made by [Open SWE](https://openswe.vercel.app/agents/18d30e16-2f6b-0d6b-e96f-fdbefa421845) Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
This commit is contained in:
@@ -71,6 +71,12 @@ class AskUserTextArea(TextArea):
|
||||
show=False,
|
||||
priority=True,
|
||||
),
|
||||
Binding(
|
||||
"ctrl+backspace,alt+backspace",
|
||||
"delete_word_left",
|
||||
"Delete left to start of word",
|
||||
show=False,
|
||||
),
|
||||
]
|
||||
|
||||
class Submitted(Message):
|
||||
|
||||
@@ -7,6 +7,7 @@ from pathlib import Path
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.binding import Binding
|
||||
from textual.widgets import Markdown, Static
|
||||
|
||||
from deepagents_code.tool_display import format_tool_display
|
||||
@@ -126,6 +127,22 @@ class TestTrailingAnnotationRegex:
|
||||
assert _TRAILING_ANNOTATION_RE.sub("", text) == text
|
||||
|
||||
|
||||
class TestAskUserTextAreaBindings:
|
||||
"""Ensures the ask-user text area matches chat input editing shortcuts."""
|
||||
|
||||
def test_modified_backspace_deletes_word_left(self) -> None:
|
||||
"""Modified Backspace aliases should delete the previous word."""
|
||||
word_delete_keys = {
|
||||
key.strip()
|
||||
for binding in AskUserTextArea.BINDINGS
|
||||
if isinstance(binding, Binding) and binding.action == "delete_word_left"
|
||||
for key in binding.key.split(",")
|
||||
}
|
||||
|
||||
assert "ctrl+backspace" in word_delete_keys
|
||||
assert "alt+backspace" in word_delete_keys
|
||||
|
||||
|
||||
class TestAskUserMenu:
|
||||
def test_find_menu_logs_when_hierarchy_is_missing(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user