Skip to content

chore: remove redundant intermediate csi checks#893

Merged
gdamore merged 1 commit intomainfrom
gdamore/csi-no-interm
Dec 7, 2025
Merged

chore: remove redundant intermediate csi checks#893
gdamore merged 1 commit intomainfrom
gdamore/csi-no-interm

Conversation

@gdamore
Copy link
Owner

@gdamore gdamore commented Dec 7, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Improved keyboard input handling for terminal and console environments, enabling proper recognition of additional key sequences in various input scenarios.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 7, 2025

Walkthrough

Conditional checks in CSI (Control Sequence Introducer) handling were relaxed in input.go. The '_' case now applies Win32-like key mappings when P has elements, removing the intermediate-bytes-empty requirement. The '~' case similarly removed intermediate-bytes-empty constraints, processing when P has at least two elements and no LT prefix, broadening key mapping coverage.

Changes

Cohort / File(s) Summary
CSI handling conditional logic
input.go
Modified conditional checks in CSI sequence handling: relaxed intermediate byte requirements for both '_' (handleWinKey) and '~' (application-mode keys) cases to trigger key mappings under broader conditions

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Areas requiring attention:

  • Impact on CSI sequence parsing and how intermediate bytes affect routing to different handlers
  • Verification that broadened conditions don't inadvertently capture unintended sequences
  • Testing coverage for edge cases with various intermediate byte configurations
  • Interaction with existing key mapping logic to ensure no regressions

Possibly related PRs

Poem

🐰 A whisker-twitch of CSI delight,
Intermediate bytes no longer hold tight,
Keys map more freely, conditions now wide,
Win32-like sequences take their stride!
With broadened logic, we hop through with glee!

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 PR title accurately describes the main change: removing redundant intermediate CSI checks by broadening conditional triggers for handling CSI sequences.
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/csi-no-interm

📜 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 7446a6d and 966e5b9.

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

821-825: LGTM! Redundant check correctly removed.

The intermediate bytes check is redundant here since the early return at lines 756-759 ensures intermediate is empty before reaching this case. The simplified condition improves code clarity.


836-851: LGTM! Redundant check correctly removed.

Similar to the '_' case, the intermediate bytes check is redundant here due to the early return at lines 756-759. The simplified condition maintains the same behavior while improving readability.


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

@ivanm696
Copy link

ivanm696 commented Dec 7, 2025

#103

@gdamore gdamore merged commit b407df3 into main Dec 7, 2025
13 checks passed
@gdamore gdamore deleted the gdamore/csi-no-interm branch December 7, 2025 02:19
@gdamore
Copy link
Owner Author

gdamore commented Dec 7, 2025

@ivanm696

I think this takes care of those cases:

	// this might have been an SS3 style key with modifiers applied
	if k, ok := ss3Keys[mode]; ok && P0 == 1 && len(P) > 1 {
		ip.post(NewEventKey(k, "", calcModifier(P[1])))
		return
	}

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.

2 participants