Skip to content

Commit 114f3c9

Browse files
committed
feat: Improve terminal output processing clarity and settings UI
- Add detailed comments to `processCarriageReturns` explaining line feed handling. - Relocate `terminalCompressProgressBar` setting below `terminalOutputLineLimit` for better context in UI.
1 parent 65a2cf4 commit 114f3c9

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

src/integrations/misc/extract-text.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,11 @@ export function processCarriageReturns(input: string): string {
274274
output += curLine
275275
}
276276

277-
// Add line feed (\n) if not at end of text
277+
// 'curLine' now holds the processed content of the line *without* its original terminating line feed (\n) character.
278+
// 'lineEnd' points to the position of that line feed (\n) in the original input, or to the end of the input string if no line feed (\n) was found.
279+
// This check explicitly adds the line feed (\n) character back *only if* one was originally present at this position (lineEnd < len).
280+
// This ensures we preserve the original structure, correctly handling inputs both with and without a final line feed (\n),
281+
// rather than incorrectly injecting a line feed (\n) if the original input didn't end with one.
278282
if (lineEnd < len) output += "\n"
279283

280284
// Move to next line

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,18 @@ export const TerminalSettings = ({
7777
</div>
7878
</div>
7979

80+
<div>
81+
<VSCodeCheckbox
82+
checked={terminalCompressProgressBar ?? true}
83+
onChange={(e: any) => setCachedStateField("terminalCompressProgressBar", e.target.checked)}
84+
data-testid="terminal-compress-progress-bar-checkbox">
85+
<span className="font-medium">{t("settings:terminal.compressProgressBar.label")}</span>
86+
</VSCodeCheckbox>
87+
<div className="text-vscode-descriptionForeground text-sm mt-1">
88+
{t("settings:terminal.compressProgressBar.description")}
89+
</div>
90+
</div>
91+
8092
<div>
8193
<label className="block font-medium mb-1">
8294
{t("settings:terminal.shellIntegrationTimeout.label")}
@@ -179,18 +191,6 @@ export const TerminalSettings = ({
179191
{t("settings:terminal.zdotdir.description")}
180192
</div>
181193
</div>
182-
183-
<div>
184-
<VSCodeCheckbox
185-
checked={terminalCompressProgressBar ?? true}
186-
onChange={(e: any) => setCachedStateField("terminalCompressProgressBar", e.target.checked)}
187-
data-testid="terminal-compress-progress-bar-checkbox">
188-
<span className="font-medium">{t("settings:terminal.compressProgressBar.label")}</span>
189-
</VSCodeCheckbox>
190-
<div className="text-vscode-descriptionForeground text-sm mt-1">
191-
{t("settings:terminal.compressProgressBar.description")}
192-
</div>
193-
</div>
194194
</Section>
195195
</div>
196196
)

0 commit comments

Comments
 (0)