Skip to content

chore: simplify the handling of the rxvt key codes#892

Merged
gdamore merged 1 commit intomainfrom
gdamore/simplify-rxvt
Dec 7, 2025
Merged

chore: simplify the handling of the rxvt key codes#892
gdamore merged 1 commit intomainfrom
gdamore/simplify-rxvt

Conversation

@gdamore
Copy link
Owner

@gdamore gdamore commented Dec 7, 2025

This improves readability, and eliminates an extra test when parsing incoming escape sequences.

Summary by CodeRabbit

  • Refactor
    • Improved control sequence parsing logic for better handling of specific character sequences. Refined the parsing conditions to more consistently route sequences through the appropriate handlers, ensuring clearer control flow without changing outcomes for most operations.

✏️ Tip: You can customize this high-level summary in your review settings.

This improves readability, and eliminates an extra test when parsing
incoming escape sequences.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 7, 2025

Walkthrough

This change modifies the CSI parsing logic in input.go to explicitly handle the '$' character with existing CSI parameters by routing it to handleCsi, rather than treating it as a generic intermediate byte. The modification reorders conditional branches in the CSI parsing path without altering outcomes for most other intermediate bytes.

Changes

Cohort / File(s) Change Summary
CSI Parsing Logic
input.go
Added explicit branch for '$' with CSI parameters that routes to handleCsi; reordered intermediate byte handling conditions (0x20-0x2F) to prioritize '$' parameter case

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10–15 minutes

  • Areas requiring extra attention:
    • Verify CSI sequence specifications to ensure '$' with parameters is correctly routed to handleCsi
    • Review existing test coverage for CSI sequences with '$' to ensure no regressions
    • Confirm that edge cases with mixed parameters and intermediate bytes continue to function as intended

Poem

🐰 A dollar sign found its way home at last,
Through handleCsi's gate, no longer outcast!
With parameters held tight, it takes the right turn,
CSI parsing blooms—a lesson to learn! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is fully related to the main change in the changeset—it describes simplifying rxvt key code handling, which aligns with the summary of CSI parsing refinements in input.go.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch gdamore/simplify-rxvt

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 783004d and 7446a6d.

📒 Files selected for processing (1)
  • input.go (1 hunks)
🔇 Additional comments (1)
input.go (1)

493-494: CSI intermediate handling order looks correct and simplifies the rxvt special case

Moving the 0x20–0x2F intermediate-byte branch after the explicit r == '$' && len(ip.csiParams) > 0 check ensures that rxvt’s non-standard terminating $ with parameters is always treated as a CSI final (and dispatched via handleCsi), while preserving the prior behavior for all other intermediates and for $ without params. This removes a redundant runtime test in the intermediate path without introducing new edge cases in the state machine.


Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant