Skip to content

fix(ui): keep selections visible without host colors - #2710

Open
akbash-bot wants to merge 3 commits into
masterfrom
akbash/2708-mosh-selection-highlight
Open

fix(ui): keep selections visible without host colors#2710
akbash-bot wants to merge 3 commits into
masterfrom
akbash/2708-mosh-selection-highlight

Conversation

@akbash-bot

Copy link
Copy Markdown
Collaborator

Summary

  • derive the selection tint from the configured palette background when the outer terminal does not answer color queries
  • preserve the existing host-background tint path
  • cover dark and light unknown-background fallbacks

Checks

  • cargo test automatic_selection_background_contrasts_when_host_background_is_unknown
  • cargo test 'ui::panes::tests'
  • just ci 'all() - test(live_server_holds_one_pty_master_fd_per_pane)' (3418 tests passed; excluded test cannot discover its successful replacement process because Kennel's isolated CARGO_TARGET_DIR is outside the checkout)
  • just windows-lint
  • maintenance Python tests (98 passed)

just check reached the same unrelated live-handoff harness incompatibility; server logs show the handoff and replacement process completed successfully.

refs #2708

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 00e61fec-a5d4-40c4-8dcb-9bc00f76f5ec

📥 Commits

Reviewing files that changed from the base of the PR and between d7a0d87 and bb85fdd.

📒 Files selected for processing (1)
  • src/ui/panes.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/ui/panes.rs

📝 Walkthrough

Walkthrough

The selection background calculation now falls back to the palette background when the host does not report one. The change includes contrast tests for dark and light palettes and an unreleased changelog entry.

Changes

Selection Background Handling

Layer / File(s) Summary
Palette fallback and contrast validation
src/ui/panes.rs, docs/next/CHANGELOG.md
automatic_selection_bg uses the palette background when the host background is unavailable. It applies luminance blending when RGB conversion succeeds. Tests cover dark and light palette backgrounds. The changelog records the fix.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: keeping selections visible when host terminal colors are unavailable.
Description check ✅ Passed The description directly explains the selection fallback behavior, preserved behavior, tests, and issue reference.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch akbash/2708-mosh-selection-highlight

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

@kangal-bot kangal-bot added the ai-review Trigger automated AI reviews for pull requests admitted by the PR gate label Aug 12, 2026

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
src/ui/panes.rs (1)

1612-1626: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Strengthen the fallback regression test.

The test only checks abs(selected_luminance - base_luminance) > 0.08. A fixed contrasting color could satisfy this for both inputs. Compare the unknown-host result with the same palette used as a known TerminalTheme.background, then assert that dark inputs become lighter and light inputs become darker.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f657565a-2f59-4ba4-af93-c02b94c95939

📥 Commits

Reviewing files that changed from the base of the PR and between 5600197 and d7a0d87.

📒 Files selected for processing (2)
  • docs/next/CHANGELOG.md
  • src/ui/panes.rs

@akbash-bot

Copy link
Copy Markdown
Collaborator Author

CodeRabbit review 4915525043: agreed, strengthened the regression to match the known-host tint path and assert the dark/light direction in bb85fdd.

@greptile-apps

greptile-apps Bot commented Aug 12, 2026

Copy link
Copy Markdown

Greptile Summary

The PR improves selection visibility when the outer terminal does not report its background color.

  • Derives the fallback selection tint from the configured palette background.
  • Preserves host-background tinting when terminal color metadata is available.
  • Adds dark- and light-palette fallback coverage and documents the fix.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/ui/panes.rs Uses the palette background as the selection-tint source when the host background is unavailable and adds focused fallback tests.
docs/next/CHANGELOG.md Documents improved selection visibility in terminals that do not report their background color.

Reviews (2): Last reviewed commit: "Merge branch 'master' into akbash/2708-m..." | Re-trigger Greptile

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

Labels

ai-review Trigger automated AI reviews for pull requests admitted by the PR gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants