You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: standardize carriage return (\r) and line feed (\n) terminology
Improve code clarity by consistently adding escape sequence notation to all
references of carriage returns and line feeds throughout documentation and tests.
This makes the code more readable and avoids ambiguity when discussing these special characters.
Copy file name to clipboardExpand all lines: .changeset/cuddly-cows-sip.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,10 +2,10 @@
2
2
"roo-cline": patch
3
3
---
4
4
5
-
I introduced a new method `processCarriageReturns` in `TerminalProcess.ts` to process carriage returns in terminal output. This method splits the output into lines, handles each line with `\r` by retaining only the content after the last carriage return, and preserves escape sequences to avoid breaking terminal formatting. The method is called within `getUnretrievedOutput` to ensure output is processed before being displayed. Additionally, I added comprehensive test cases in `TerminalProcess.test.ts` under a new `describe("processCarriageReturns", ...)` block to validate various scenarios, including basic progress bars, multiple lines, and ANSI escape sequences.
5
+
I introduced a new method `processCarriageReturns` in `TerminalProcess.ts` to process carriage returns (\r) in terminal output. This method splits the output into lines, handles each line with carriage returns (\r) by retaining only the content after the last carriage return (\r), and preserves escape sequences to avoid breaking terminal formatting. The method is called within `getUnretrievedOutput` to ensure output is processed before being displayed. Additionally, I added comprehensive test cases in `TerminalProcess.test.ts` under a new `describe("processCarriageReturns", ...)` block to validate various scenarios, including basic progress bars, multiple lines with mixed carriage returns (\r) and line feeds (\n), and ANSI escape sequences.
6
6
7
7
Key implementation details:
8
8
9
9
- The solution carefully handles special characters and escape sequences to maintain terminal integrity.
10
-
- Tradeoff: Slightly increased processing overhead for outputs with carriage returns, but this is negligible compared to the improved user experience.
11
-
- I’d like reviewers to pay close attention to the handling of edge cases in `processCarriageReturns` (e.g., lines ending with `\r` or mixed content with escape sequences) to ensure no unintended side effects.
10
+
- Tradeoff: Slightly increased processing overhead for outputs with carriage returns (\r), but this is negligible compared to the improved user experience.
11
+
- I'd like reviewers to pay close attention to the handling of edge cases in `processCarriageReturns` (e.g., lines ending with carriage returns (\r) or mixed content with carriage returns (\r), line feeds (\n), and escape sequences) to ensure no unintended side effects.
it("should correctly handle complex patterns of alternating carriage returns and newlines",()=>{
433
+
it("should correctly handle complex patterns of alternating carriage returns (\r) and line feeds (\n)",()=>{
434
434
// Break down the example:
435
-
// 1. "Line1" + CR + NL: CR moves cursor to start of line, NL moves to next line, preserving "Line1"
436
-
// 2. "Line2" + CR: CR moves cursor to start of line
435
+
// 1. "Line1" + carriage return (\r) + line feed (\n): carriage return (\r) moves cursor to start of line, line feed (\n) moves to next line, preserving "Line1"
436
+
// 2. "Line2" + carriage return (\r): carriage return (\r) moves cursor to start of line
437
437
// 3. "Line2Updated" overwrites "Line2"
438
-
// 4. NL: moves to next line
439
-
// 5. "Line3" + CR + NL: CR moves cursor to start, NL moves to next line, preserving "Line3"
438
+
// 4. Line feed (\n): moves to next line
439
+
// 5. "Line3" + carriage return (\r) + line feed (\n): carriage return (\r) moves cursor to start, line feed (\n) moves to next line, preserving "Line3"
0 commit comments