Skip to content

Commit f2eb51a

Browse files
lmtr0hannesrudolph
authored andcommitted
refactor: addressing pr comments made in #8556
1 parent c1c03a6 commit f2eb51a

36 files changed

+126
-33
lines changed

webview-ui/src/components/chat/ChatTextArea.tsx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { ExtensionMessage } from "@roo/ExtensionMessage"
1111
import { vscode } from "@src/utils/vscode"
1212
import { useExtensionState } from "@src/context/ExtensionStateContext"
1313
import { useAppTranslation } from "@src/i18n/TranslationContext"
14+
import { getSendMessageKeyCombination } from "@src/utils/platform"
1415
import {
1516
ContextMenuOptionType,
1617
getContextMenuOptions,
@@ -1161,7 +1162,13 @@ export const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
11611162
</button>
11621163
</StandardTooltip>
11631164
)}
1164-
<StandardTooltip content={t("chat:sendMessage")}>
1165+
<StandardTooltip
1166+
content={
1167+
requireCtrlEnterToSend
1168+
? t("chat:sendMessage") +
1169+
` (${t("chat:pressToSend", { keyCombination: getSendMessageKeyCombination() })})`
1170+
: t("chat:sendMessage")
1171+
}>
11651172
<button
11661173
aria-label={t("chat:sendMessage")}
11671174
disabled={false}
@@ -1201,6 +1208,22 @@ export const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
12011208
{placeholderBottomText}
12021209
</div>
12031210
)}
1211+
{requireCtrlEnterToSend && (
1212+
<div
1213+
className={cn(
1214+
"absolute left-2 z-30 flex items-center h-8 font-vscode-font-family text-vscode-editor-font-size leading-vscode-editor-line-height",
1215+
isEditMode ? "pr-20" : "pr-9",
1216+
)}
1217+
style={{
1218+
bottom: "0.25rem",
1219+
color: "color-mix(in oklab, var(--vscode-descriptionForeground) 70%, transparent)",
1220+
userSelect: "none",
1221+
pointerEvents: "none",
1222+
fontSize: "0.75rem",
1223+
}}>
1224+
{t("chat:pressToSend", { keyCombination: getSendMessageKeyCombination() })}
1225+
</div>
1226+
)}
12041227
</div>
12051228
</div>
12061229
</div>

webview-ui/src/components/settings/UISettings.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { HTMLAttributes } from "react"
22
import { useAppTranslation } from "@/i18n/TranslationContext"
3+
import { getPrimaryModifierKey } from "@/utils/platform"
34
import { VSCodeCheckbox } from "@vscode/webview-ui-toolkit/react"
45
import { Glasses } from "lucide-react"
56
import { telemetryClient } from "@/utils/TelemetryClient"
@@ -71,10 +72,14 @@ export const UISettings = ({
7172
checked={requireCtrlEnterToSend ?? false}
7273
onChange={(e: any) => handleRequireCtrlEnterToSendChange(e.target.checked)}
7374
data-testid="ctrl-enter-checkbox">
74-
<span className="font-medium">{t("settings:ui.requireCtrlEnterToSend.label")}</span>
75+
<span className="font-medium">
76+
{t("settings:ui.requireCtrlEnterToSend.label", { primaryMod: getPrimaryModifierKey() })}
77+
</span>
7578
</VSCodeCheckbox>
7679
<div className="text-vscode-descriptionForeground text-sm ml-5 mt-1">
77-
{t("settings:ui.requireCtrlEnterToSend.description")}
80+
{t("settings:ui.requireCtrlEnterToSend.description", {
81+
primaryMod: getPrimaryModifierKey(),
82+
})}
7883
</div>
7984
</div>
8085
</div>

webview-ui/src/i18n/locales/ca/chat.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/ca/settings.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/de/chat.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/en/chat.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@
130130
"enhancePromptDescription": "The 'Enhance Prompt' button helps improve your prompt by providing additional context, clarification, or rephrasing. Try typing a prompt in here and clicking the button again to see how it works.",
131131
"addImages": "Add images to message",
132132
"sendMessage": "Send message",
133+
"pressToSend": "Press {{keyCombination}} to send",
133134
"stopTts": "Stop text-to-speech",
134135
"typeMessage": "Type a message...",
135136
"typeTask": "Type your task here...",

webview-ui/src/i18n/locales/en/settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
"description": "When enabled, thinking blocks will be collapsed by default until you interact with them"
4545
},
4646
"requireCtrlEnterToSend": {
47-
"label": "Require Ctrl/Cmd+Enter to send messages",
48-
"description": "When enabled, you must press Ctrl or Cmd+Enter to send messages instead of just Enter"
47+
"label": "Require {primaryMod}+Enter to send messages",
48+
"description": "When enabled, you must press {primaryMod}+Enter to send messages instead of just Enter"
4949
}
5050
},
5151
"prompts": {

webview-ui/src/i18n/locales/es/chat.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/es/settings.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/fr/chat.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)