Restore Kitty Mode 2031 color-scheme reports - #209
Conversation
(cherry picked from commit 9fd00e0)
When changeConditionalState returns null (no theme-conditional config rules), the Termio DerivedConfig inherits conditional_state from the app-level config which defaults to .light and is never updated. This caused colorSchemeReportLocked to always report light mode. Fix: override conditional_state with the surface's own config_conditional_state after creating the Termio DerivedConfig. (cherry picked from commit 2be58ee)
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe update preserves the active surface color scheme across termio configuration reloads, synchronizes appearance callbacks with termio state, and suppresses duplicate color-scheme reports after Mode 2031 enables reporting. ChangesColor Scheme Reporting
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The PR restores immediate and surface-correct Kitty color-scheme reports while preserving appearance-change reporting; no actionable merge-blocking risk remains after normal checks and review. Sequence Diagram(s)sequenceDiagram
participant AppearanceCallback
participant Surface
participant Termio
participant StreamHandler
participant MessageWriter
AppearanceCallback->>Surface: update config_conditional_state.theme
Surface->>Termio: updateColorScheme(new_scheme)
StreamHandler->>Termio: enable report_color_scheme
StreamHandler->>Termio: queue forced ColorSchemeReport
Termio->>MessageWriter: queue color-scheme report
Termio->>Termio: suppress matching stale non-forced report
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Docstring CoverageExplanation No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (4 skipped: 4 unsupported.) ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Update the termio-owned color scheme synchronously when a surface appearance callback arrives, because embedders may suppress the follow-up reload action. Preserve that authoritative state across queued config swaps so CSI 996 and Mode 2031 cannot report a stale theme. Co-authored-by: Magicien <162632566+lederniermagicien@users.noreply.github.com>
There was a problem hiding this comment.
No issues found across 3 files
You’re at about 92% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.
Co-authored-by: lederniermagicien <162632566+lederniermagicien@users.noreply.github.com>
Keep the mode 2031 enable report authoritative when queued config updates cross the parser boundary, while preserving per-surface theme state and mirror response suppression. Co-authored-by: Magicien <lederniermagicien@users.noreply.github.com>
Keep the authoritative Mode 2031 initial reply free of a queued same-theme config duplicate while preserving direct queries, real transitions, resets, and mirror response suppression. Co-authored-by: Magicien <lederniermagicien@users.noreply.github.com>
Summary
Restore the Kitty color-scheme protocol behavior needed by cmux PR ghostty-org#10527 / issue ghostty-org#5490:
CSI ? 997;N nresult immediately when private Mode 2031 is enabled;The initial report change preserves the contributor's original implementation and attribution from
9fd00e0e4d902f938953fd23d18cb39469f5db5c; the conditional-state correction is cherry-picked from2be58ee0edf055e6444b074e4a51e9ec29dfb082.This branch is a fast-forward descendant of current
main. It is referenced by cmux PR #10527.Verification
zig build test -Dtest-filter='terminal response suppression' --summary all(73/73)zig build test -Dtest-filter='color scheme report' --summary all(74/74)zig build test -Dtest-filter='changeConditionalState' --summary all(74/74)zig fmt --check src/Surface.zig src/termio/stream_handler.zigNeed help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Restores the Kitty color-scheme protocol for mode 2031 so enabling the mode immediately reports the current scheme and later appearance changes report on the owning surface. It also keeps the reported theme aligned with each surface's resolved conditional state, including when no conditional rules are set.
Termioconfig uses its own conditional theme state, so surfaces without conditional rules no longer report a stale light mode.Termiocolor scheme synchronously and preserve it across queued config swaps, soCSI 996and Mode 2031 cannot report a stale theme.Written for commit b39533b. Summary will update on new commits.
Summary by CodeRabbit