-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix terminal escape sequence printing bug #1544
Conversation
WalkthroughThe pull request introduces a modification to the Changes
Poem
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
frontend/app/view/term/termwrap.ts (1)
168-170
: Consider adding a debug log for skipped input.For debugging purposes, it might be helpful to log when input is skipped due to the terminal not being loaded yet.
if (!this.loaded) { + dlog("skipping terminal input, not loaded yet"); return; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
frontend/app/view/term/termwrap.ts
(1 hunks)
🔇 Additional comments (2)
frontend/app/view/term/termwrap.ts (2)
168-170
: LGTM! The early return fixes the escape sequence printing bug.
The change correctly prevents processing terminal input data before the terminal is fully initialized. This aligns with the existing pattern in handleNewFileSubjectData
which buffers data when not loaded.
Let's verify there are no other methods that need similar protection:
✅ Verification successful
The early return in handleTermData
is correctly placed and other handlers are properly protected
The verification shows three handler methods in TermWrap
:
handleTermData
: Now has the early return when not loadedhandleNewFileSubjectData
: Already has protection for unloaded state as mentioned in the reviewhandleResize
: Handles window resizing which is independent of the loaded state
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for other terminal data handling methods that might need the loaded check
ast-grep --pattern 'class TermWrap {
$$$
handle$_($$$) {
$$$
}
$$$
}'
Length of output: 83
Script:
#!/bin/bash
# Let's try a different approach to find handler methods in TermWrap
rg -A 2 "^[[:space:]]*handle.*\(" "frontend/app/view/term/termwrap.ts"
Length of output: 465
168-170
: Verify race condition handling around the loaded flag.
The loaded
flag is set after loadInitialTerminalData()
completes. Please ensure that any buffered input in heldData
is properly processed after the terminal is loaded.
Let's check the initialization flow:
✅ Verification successful
Race condition handling for loaded
flag is properly implemented
The code correctly handles buffered input through the heldData
array. Here's how the race condition is prevented:
heldData
is initialized as an empty array in the constructor- In
handleNewFileSubjectData
, incoming data is buffered inheldData
whenloaded
is false - The
loaded
flag is set to true only afterloadInitialTerminalData()
completes ininitTerminal()
- Input data in
handleTermData
is properly guarded with theloaded
check
The implementation ensures no data is lost during initialization and the terminal state remains consistent.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for places where heldData is processed after loading
ast-grep --pattern 'class TermWrap {
$$$
initTerminal() {
$$$
this.loaded = true;
$$$
}
$$$
}'
Length of output: 116
Script:
#!/bin/bash
# Let's first find the file content to understand the initialization flow
cat frontend/app/view/term/termwrap.ts
# Also search for any references to heldData
rg "heldData" -A 5 frontend/app/view/term/termwrap.ts
Length of output: 11822
Summary by CodeRabbit