Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions application/i18n/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,9 @@ const en: Messages = {
'settings.terminal.behavior.preserveSelectionOnInput': 'Keep selection while typing',
'settings.terminal.behavior.preserveSelectionOnInput.desc':
'Don\'t clear mouse-selected text when typing — useful for selecting a path then pasting it after a command prefix like `sz `.',
'settings.terminal.behavior.forcePromptNewLine': 'Prompt on a new line',
'settings.terminal.behavior.forcePromptNewLine.desc':
'When the final line of command output is not terminated by a newline, move the recognized shell prompt to the next visual line.',
'settings.terminal.behavior.osc52Clipboard': 'OSC-52 clipboard',
'settings.terminal.behavior.osc52Clipboard.desc':
'Allow remote programs (tmux, vim, etc.) to access the local clipboard via OSC-52 escape sequences.',
Expand Down
3 changes: 3 additions & 0 deletions application/i18n/locales/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,9 @@ const ru: Messages = {
'settings.terminal.behavior.preserveSelectionOnInput': 'Сохранять выделение при вводе',
'settings.terminal.behavior.preserveSelectionOnInput.desc':
'Не сбрасывать выделенный мышью текст при вводе. Это удобно, например, чтобы выделить путь и вставить его после префикса команды вроде `sz `.',
'settings.terminal.behavior.forcePromptNewLine': 'Переносить приглашение на новую строку',
'settings.terminal.behavior.forcePromptNewLine.desc':
'Если последняя строка вывода команды не завершена переводом строки, переносить распознанное приглашение оболочки на следующую визуальную строку.',
'settings.terminal.behavior.osc52Clipboard': 'Буфер обмена OSC-52',
'settings.terminal.behavior.osc52Clipboard.desc':
'Разрешить удалённым программам (tmux, vim и т. д.) доступ к локальному буферу обмена через escape-последовательности OSC-52.',
Expand Down
3 changes: 3 additions & 0 deletions application/i18n/locales/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1465,6 +1465,9 @@ const zhCN: Messages = {
'settings.terminal.behavior.preserveSelectionOnInput': '输入时保留选区',
'settings.terminal.behavior.preserveSelectionOnInput.desc':
'键盘输入时不清除鼠标选中的文本,方便选中路径后输入 `sz ` 之类命令再粘贴。',
'settings.terminal.behavior.forcePromptNewLine': '提示符另起一行',
'settings.terminal.behavior.forcePromptNewLine.desc':
'当命令输出的最后一行未以换行符结束时,将识别到的 shell 提示符移动到下一行显示。',
'settings.terminal.behavior.osc52Clipboard': 'OSC-52 剪贴板',
'settings.terminal.behavior.osc52Clipboard.desc':
'允许远程程序(tmux、vim 等)通过 OSC-52 转义序列访问本地剪贴板。',
Expand Down
2 changes: 1 addition & 1 deletion application/syncPayload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const SYNCABLE_TERMINAL_KEYS = [
'rightClickBehavior', 'copyOnSelect', 'middleClickPaste', 'wordSeparators',
'linkModifier', 'keywordHighlightEnabled', 'keywordHighlightRules',
'keepaliveInterval', 'keepaliveCountMax', 'disableBracketedPaste', 'clearWipesScrollback',
'preserveSelectionOnInput', 'osc52Clipboard', 'showServerStats',
'preserveSelectionOnInput', 'forcePromptNewLine', 'osc52Clipboard', 'showServerStats',
'serverStatsRefreshInterval', 'rendererType',
'autocompleteEnabled', 'autocompleteGhostText', 'autocompletePopupMenu',
'autocompleteDebounceMs', 'autocompleteMinChars', 'autocompleteMaxSuggestions',
Expand Down
10 changes: 10 additions & 0 deletions components/Terminal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ import { useZmodemTransfer } from "./terminal/hooks/useZmodemTransfer";
import { createTerminalSessionStarters, type PendingAuth } from "./terminal/runtime/createTerminalSessionStarters";
import { createXTermRuntime, primaryFontFamily, type XTermRuntime } from "./terminal/runtime/createXTermRuntime";
import { applyUserCursorPreference } from "./terminal/runtime/cursorPreference";
import {
createPromptLineBreakState,
markPromptLineBreakCommandPending,
type PromptLineBreakState,
} from "./terminal/runtime/promptLineBreak";
import { shouldPreserveTerminalFocusOnMouseDown } from "./terminal/toolbarFocus";
import { preserveTerminalViewportInScrollback } from "./terminal/clearTerminalViewport";
import { XTERM_PERFORMANCE_CONFIG } from "../infrastructure/config/xtermPerformance";
Expand Down Expand Up @@ -292,6 +297,7 @@ const TerminalComponent: React.FC<TerminalProps> = ({
const terminalLogSanitizerRef = useRef(createReplaySafeTerminalLogSanitizer());
const onTerminalDataCaptureRef = useRef(onTerminalDataCapture);
const commandBufferRef = useRef<string>("");
const promptLineBreakStateRef = useRef<PromptLineBreakState>(createPromptLineBreakState());
const [hasMouseTracking, setHasMouseTracking] = useState(false);
const mouseTrackingRef = useRef(false);
const serialLineBufferRef = useRef<string>("");
Expand Down Expand Up @@ -511,6 +517,7 @@ const TerminalComponent: React.FC<TerminalProps> = ({
const cmd = commandBufferRef.current.trim();
if (cmd && onCommandExecuted) onCommandExecuted(cmd, host.id, host.label, sessionId);
commandBufferRef.current = "";
markPromptLineBreakCommandPending(promptLineBreakStateRef);
} else if (ch === "\x15") {
// Ctrl+U: clear line — reset command buffer (fuzzy match sends this)
commandBufferRef.current = "";
Expand Down Expand Up @@ -845,6 +852,7 @@ const TerminalComponent: React.FC<TerminalProps> = ({
fitAddonRef,
serializeAddonRef,
pendingAuthRef,
promptLineBreakStateRef,
updateStatus,
setStatus,
setError,
Expand Down Expand Up @@ -900,6 +908,7 @@ const TerminalComponent: React.FC<TerminalProps> = ({
setShowLogs(false);
setIsCancelling(false);
setIsDisconnectedDialogDismissed(false);
promptLineBreakStateRef.current = createPromptLineBreakState();

const boot = async () => {
try {
Expand All @@ -924,6 +933,7 @@ const TerminalComponent: React.FC<TerminalProps> = ({
statusRef,
onCommandExecuted,
commandBufferRef,
promptLineBreakStateRef,
setIsSearchOpen,
// Serial-specific options
serialLocalEcho: serialConfig?.localEcho,
Expand Down
7 changes: 7 additions & 0 deletions components/settings/tabs/SettingsTerminalTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -890,6 +890,13 @@ export default function SettingsTerminalTab(props: {
<Toggle checked={terminalSettings.preserveSelectionOnInput ?? false} onChange={(v) => updateTerminalSetting("preserveSelectionOnInput", v)} />
</SettingRow>

<SettingRow
label={t("settings.terminal.behavior.forcePromptNewLine")}
description={t("settings.terminal.behavior.forcePromptNewLine.desc")}
Comment on lines +894 to +895
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Badge Add missing locale strings for new prompt setting

This UI now renders settings.terminal.behavior.forcePromptNewLine and .desc, but only en and zh-CN were updated in this commit; application/i18n/locales/ru.ts still lacks both keys. In Russian locale, users will see raw translation keys instead of readable labels/descriptions for this new toggle, which is a user-facing regression introduced by adding these lookups without completing locale coverage.

Useful? React with 👍 / 👎.

>
<Toggle checked={terminalSettings.forcePromptNewLine ?? true} onChange={(v) => updateTerminalSetting("forcePromptNewLine", v)} />
</SettingRow>

<SettingRow
label={t("settings.terminal.behavior.osc52Clipboard")}
description={t("settings.terminal.behavior.osc52Clipboard.desc")}
Expand Down
Loading
Loading