From 319ed85f8fd40334ca29b0f06e7316c135f9e941 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Mon, 8 Sep 2025 18:32:10 +0000 Subject: [PATCH 1/3] feat: add click-to-edit, ESC-to-cancel, and fix padding consistency - Enable click-to-edit for past messages by making message text clickable - Add ESC key handler to cancel edit mode in ChatTextArea - Fix padding consistency between past and queued message editors - Adjust right padding for edit mode to accommodate cancel button Fixes #7788 --- webview-ui/src/components/chat/ChatRow.tsx | 12 ++++++++++-- webview-ui/src/components/chat/ChatTextArea.tsx | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/webview-ui/src/components/chat/ChatRow.tsx b/webview-ui/src/components/chat/ChatRow.tsx index 7b3107a2bed..ac47a9ebfb6 100644 --- a/webview-ui/src/components/chat/ChatRow.tsx +++ b/webview-ui/src/components/chat/ChatRow.tsx @@ -1174,7 +1174,7 @@ export const ChatRowContent = ({ return (
{isEditing ? ( -
+
) : (
-
+
{ + e.stopPropagation() + if (!isStreaming) { + handleEditClick() + } + }} + title={t("chat:queuedMessages.clickToEdit")}>
diff --git a/webview-ui/src/components/chat/ChatTextArea.tsx b/webview-ui/src/components/chat/ChatTextArea.tsx index c917797283c..94b674f214b 100644 --- a/webview-ui/src/components/chat/ChatTextArea.tsx +++ b/webview-ui/src/components/chat/ChatTextArea.tsx @@ -1030,7 +1030,15 @@ export const ChatTextArea = forwardRef( updateHighlights() }} onFocus={() => setIsFocused(true)} - onKeyDown={handleKeyDown} + onKeyDown={(e) => { + // Handle ESC to cancel in edit mode + if (isEditMode && e.key === "Escape" && !e.nativeEvent?.isComposing) { + e.preventDefault() + onCancel?.() + return + } + handleKeyDown(e) + }} onKeyUp={handleKeyUp} onBlur={handleBlur} onPaste={handlePaste} @@ -1071,7 +1079,7 @@ export const ChatTextArea = forwardRef( "resize-none", "overflow-x-hidden", "overflow-y-auto", - "pr-9", + isEditMode ? "pr-[72px]" : "pr-9", "flex-none flex-grow", "z-[2]", "scrollbar-none", From f7b710a4155b08498246ed63528740dc7c455b18 Mon Sep 17 00:00:00 2001 From: Hannes Rudolph Date: Mon, 8 Sep 2025 15:29:06 -0600 Subject: [PATCH 2/3] fix: adjust padding and layout for ChatTextArea in edit mode --- webview-ui/src/components/chat/ChatRow.tsx | 3 +- .../src/components/chat/ChatTextArea.tsx | 36 ++++++++----------- 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/webview-ui/src/components/chat/ChatRow.tsx b/webview-ui/src/components/chat/ChatRow.tsx index ac47a9ebfb6..f24e2ca6602 100644 --- a/webview-ui/src/components/chat/ChatRow.tsx +++ b/webview-ui/src/components/chat/ChatRow.tsx @@ -1172,7 +1172,8 @@ export const ChatRowContent = ({ ) case "user_feedback": return ( -
+
{isEditing ? (
( return (
( : isDraggingOver ? "border-2 border-dashed border-vscode-focusBorder" : "border border-transparent", - "px-[8px]", - "py-1.5", - "pr-9", + "pl-2", + "py-2", + isEditMode ? "pr-[72px]" : "pr-9", "z-10", "forced-color-adjust-none", + "rounded", )} style={{ color: "transparent", @@ -1062,7 +1051,7 @@ export const ChatTextArea = forwardRef( "text-vscode-editor-font-size", "leading-vscode-editor-line-height", "cursor-text", - "py-1.5 px-2", + "py-2 pl-2", isFocused ? "border border-vscode-focusBorder outline outline-vscode-focusBorder" : isDraggingOver @@ -1088,7 +1077,7 @@ export const ChatTextArea = forwardRef( onScroll={() => updateHighlights()} /> -
+
-
+
{isEditMode && (