Skip to content

fix(settings): polish TUI mouse interactions and dirty markers#2395

Open
NihilDigit wants to merge 1 commit into
sinelaw:masterfrom
NihilDigit:codex/settings-tui-polish
Open

fix(settings): polish TUI mouse interactions and dirty markers#2395
NihilDigit wants to merge 1 commit into
sinelaw:masterfrom
NihilDigit:codex/settings-tui-polish

Conversation

@NihilDigit

@NihilDigit NihilDigit commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR fixes several user-visible rough edges in the TUI Settings panel:

  • Fixes mouse hit-testing for toggle controls in plugin settings, so clicking the visible toggle chip reliably changes the value.
  • Shows the current settings page title in the right panel.
  • Truncates long plugin category names in the left tree with an explicit ellipsis.
  • Keeps the left tree highlight visible after clicking a nested settings section.
  • Aligns toggle mouse behavior with other settings controls: clicking the row/label selects the setting, while clicking the rendered toggle chip changes the value.
  • Clears modified markers when a setting is changed back to its original value, including plugin settings.

Visual context

This screenshot shows the new right-panel title and the left-tree truncation behavior for long plugin names:

Settings panel showing page title and truncated plugin category names

Notes

The left tree remains fixed-width. Plugin names come from external input and can be arbitrarily long, so this keeps the sidebar stable and uses the right-panel title to preserve page context.

Toggle mouse behavior now uses a narrower hit target than before. Previously, parts of the label row could also toggle the value. I think using the label/row for selection and the chip for mutation is less surprising and matches Dropdown, Number, and Text controls, but this can be adjusted if the preferred Settings behavior is clicking anywhere on the toggle row to toggle.

Testing

  • cargo fmt --check
  • cargo build -p fresh-editor
  • cargo check --all-targets
  • cargo clippy --all-targets
  • cargo test -p fresh-editor --quiet pad_to_display_width_uses_terminal_columns
  • cargo test -p fresh-editor --quiet truncate_display_width_with_ellipsis
  • cargo test -p fresh-editor --quiet dropdown_reverting_to_original_value_clears_pending_and_row_modified
  • cargo test -p fresh-editor --quiet reset_after_unsaved_inherited_dropdown_change_cancels_pending_edit
  • cargo test -p fresh-editor --quiet test_hit_test_item_with_toggle
  • cargo test -p fresh-editor --test e2e_tests --quiet settings::test_settings_toggle
  • cargo test -p fresh-editor --test e2e_tests --quiet settings::test_plugin_toggle_mouse_click_chip_matches_visual_position
  • cargo test -p fresh-editor --test e2e_tests --quiet settings_tree_view
  • codex review --commit HEAD

@sinelaw sinelaw added the in-review label Jun 18, 2026 — with Claude

@sinelaw sinelaw left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This is an autogenerated comment

  • Right-panel page title: Confirmed "General", "Plugin: dashboard", and "Plugin: git_explorer" all appear correctly in bold as the right-panel title; this gives full context when sidebar names are truncated.
  • Plugin name truncation: Verified Plugin: git_ex... truncated with ellipsis in the fixed-width sidebar while the right panel shows the full name. Display-width-aware truncation correctly handles CJK/emoji names without overflow.
  • Toggle dirty markers: Toggling Check For Updates shows (modified) in the title bar and on the setting row and parent category. Toggling back to the original value clears all markers immediately (no save needed). Same behavior confirmed for the Plugin: git_explorer ColorNames toggle reverting to its schema default.
  • Left-tree focus: After navigating into an Editor section via keyboard, the > focus cursor correctly stays in the left tree panel rather than jumping to the body.
  • Hit-test fix: ControlLayoutInfo::Toggle now stores checkbox_area instead of full_area, scoping the toggle click target to the visible chip only. Layout test updated accordingly.
  • Unit tests: All PR-listed unit tests pass (pad_to_display_width_uses_terminal_columns, three truncate_display_width_with_ellipsis_* tests, dropdown_reverting_to_original_value_clears_pending_and_row_modified, reset_after_unsaved_inherited_dropdown_change_cancels_pending_edit, test_hit_test_item_with_toggle).
  • Code quality: New helpers (path_has_pending_change, page_has_pending_changes, effective_original_value) are well-scoped abstractions with clear semantics; no duplication. The paths_intersect function correctly handles JSON pointer prefix matching. Follows all CONTRIBUTING.md guidelines (display-width APIs, no full-buffer scans, tests reproduce each behavioral claim).

Generated by Claude Code

@sinelaw sinelaw added reviewed and removed in-review labels Jun 18, 2026 — with Claude
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants