Skip to content

Fix CSI '=' prefix handling - #3

Open
Polymorph0us wants to merge 2 commits into
micro-editor:masterfrom
Polymorph0us:fix/fish-terminal-compatibility
Open

Fix CSI '=' prefix handling#3
Polymorph0us wants to merge 2 commits into
micro-editor:masterfrom
Polymorph0us:fix/fish-terminal-compatibility

Conversation

@Polymorph0us

Copy link
Copy Markdown

Summary

Fixed handling of the ESC[=u CSI sequence.

Previously, ESC[=u was parsed as ESC[u, causing the terminal emulator to incorrectly restore the cursor position. This sequence is used by the kitty keyboard protocol and should not be treated as the standard cursor-restore sequence.

Changes

  • Track the = CSI prefix separately.
  • Only restore the cursor for ESC[u.
  • Add regression tests for both ESC[u and ESC[=u.

Testing

  • go test ./...
  • Manually verified the behavior in Micro's embedded terminal.

This addresses the ESC[=u compatibility issue described in micro-editor/micro#4083.

Copilot AI lite review requested due to automatic review settings September 2, 2026 05:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

CSI prefix tracking is incomplete, so some prefixed sequences (e.g., with >/<) can still be misinterpreted as unprefixed ESC[u despite the new prefix == 0 restore guard.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR fixes CSI parsing so the terminal no longer treats the kitty keyboard protocol sequence ESC[=u as the standard cursor-restore sequence ESC[u, preventing unintended cursor restoration.

Changes:

  • Add explicit CSI prefix tracking (= vs none) during CSI parse.
  • Gate cursor restoration (CSI u) so it only triggers for unprefixed ESC[u.
  • Add regression tests covering ESC[u (restore) vs ESC[=u (no restore).
File summaries
File Description
csi.go Tracks a CSI prefix and uses it to avoid restoring the cursor for prefixed u sequences.
csi_test.go Adds regression tests ensuring ESC[=u does not restore the cursor while ESC[u does.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread csi.go Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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