You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(settings): keep the icon when a Settings icon field is cleared - #1100
Settings stored icon values untrimmed while the config.yml loader trims them and skips empty values, so the two disagreed. Clearing Active Source Icon or List Highlight Icon saved "": the device-picker marker and the list cursor disappeared for the rest of the session, and the default quietly came back on the next launch. A padded one-cell icon like " » " was rejected by the width check even though the same value in config.yml loads fine.
apply_settings_changes now trims each icon value once: the six one-cell icons are width-checked on the trimmed value and stored trimmed, and Active Source Icon / List Highlight Icon keep their current value when the trimmed value is empty, same as the loader. The free-form label icons (Liked, Shuffle, Paused, Repeat) are untouched, also matching the loader.
cargo test --no-default-features --features telemetry,tui — 1960 passed; 0 failed
cargo test --no-default-features --features telemetry,tui settings_apply — 8 passed, both new tests listed
Before the fix, the two new tests failed: clearing_the_active_source_or_list_highlight_icon_keeps_the_current_icon (saved "" instead of keeping ●) and a_padded_one_cell_icon_is_saved_trimmed (rejected " » ")
Additional notes
The Settings row still shows the cleared value after a save, the same as a rejected gauge icon today; reverting the row is out of scope per the issue.
💬 Questions or want to chat with other contributors? Join the spotatui Discord.
Summary by CodeRabbit
Bug Fixes
Icon settings now trim surrounding whitespace before saving.
Clearing the Active Source or List Highlight icon keeps its current value.
Icons that don’t fit the required single-cell width remain unchanged and show an error.
The Settings save path stored icon values untrimmed while the config
loader trims them and skips empty values, so the two disagreed: a
cleared Active Source or List Highlight Icon saved an empty string,
and a padded one-cell icon like " >> " was rejected though the same
value in config.yml loads.
Trim once in apply_settings_changes: width-check and store the trimmed
value for the six one-cell icons, and keep the current icon for the
two free-form icons when the trimmed value is empty.
FixesLargeModGames#1062
No actionable comments were generated in the recent review.
Walkthrough
Settings now trims icon values before validation and storage. Empty or whitespace-only Active Source Icon and List Highlight Icon inputs preserve their current values. Tests cover the updated behavior.
Changes: Settings icon handling
Layer / File(s)
Summary
Trim and preserve icon values src/core/app/settings_apply.rs, CHANGELOG.md
The six width-validated icon settings are trimmed before width checks and storage. Empty or whitespace-only Active Source Icon and List Highlight Icon inputs leave the current values unchanged. Tests cover these cases and padded icon values.
Settings now accepts padded one-cell icons, and clearing the Active Source or List Highlight icon keeps the current icon. The change is narrow, covered by new tests, and has no identified merge-blocking risk.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title uses the conventional-commit prefix "fix" with the scope "settings", which matches the required format. It describes the main change: clearing a Settings icon field keeps the current icon. T…
Linked Issues check
Single directly linked issue #1062. No stack evidence was supplied, so the assessment covers the current PR only.
Objective 1 [#1062]: Clearing Active Source Icon or List Highlight Icon keeps the cur…
Out of Scope Changes check
The whole-PR diff (merge base b8fa4fe to head 6cc2ab3) touches src/core/app/settings_apply.rs only, within the scope of #1062. Every hunk in that file is in the one-cell arm, the `active_source_icon…
Full details: Title check
Explanation
The title uses the conventional-commit prefix "fix" with the scope "settings", which matches the required format. It describes the main change: clearing a Settings icon field keeps the current icon. The title is concise, but the subject is written in the third person ("keep", not the imperative "keep" form used as an instruction), so it fits the imperative requirement. The title also omits the trimming change for one-cell icons, which is a secondary part of the PR, so it is partially related in scope but still captures the main point.
Full details: Linked Issues check
Explanation
Single directly linked issue #1062. No stack evidence was supplied, so the assessment covers the current PR only.
Objective 1 [#1062]: Clearing Active Source Icon or List Highlight Icon keeps the current icon. Addressed. In apply_settings_changes (src/core/app/settings_apply.rs), the behavior.active_source_icon and behavior.list_highlight_icon arms now compute let icon = v.trim(); and assign only when !icon.is_empty(). Empty and spaces-only values leave the defaults ● and ▶ in place. The padded value " ◆ " is stored as "◆". Test: clearing_the_active_source_or_list_highlight_icon_keeps_the_current_icon.
Objective 2 [#1062]: The six one-cell icons (playing, gauge filled/unfilled, episode played, sort ascending/descending) are trimmed before the width check and storage. Addressed. The shared arm computes icon = v.trim(), checks UnicodeWidthStr::width(icon) == 1, and stores icon.to_string() in all six inner arms. A padded " » " is saved as "»". An empty value has width 0 and goes to the existing rejection path with the icon_width message. Test: a_padded_one_cell_icon_is_saved_trimmed, which also asserts status_message() is None.
Objective 3 [#1062]: Free-form label icons (liked, shuffle, paused, repeat) are not trimmed. Addressed. The diff does not change those arms.
Objective 4 [#1062]: Config loader unchanged, no new status message for empty values, tools/gates.count unchanged. Addressed. The diff touches only src/core/app/settings_apply.rs. The diff for tools/gates.count is empty.
Note: the PR objectives text lists a padded free-form icon trim among the acceptance criteria. The issue body states that free-form label icons are excluded from trimming. The current PR follows the issue body. This PR does not add a test for a padded free-form icon, and the issue body does not require one.
Uncertainty: I did not run the test suite. Test results rely on the diff and the author's reported results.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff (merge base b8fa4fe to head 6cc2ab3) touches src/core/app/settings_apply.rs only, within the scope of #1062. Every hunk in that file is in the one-cell arm, the active_source_icon and list_highlight_icon arms, or the new tests in mod tests. No unrelated refactoring or behavior change appears. The tools/gates.count diff is empty, as the issue requires. The raw summary reports a single added line under CHANGELOG.md## [Unreleased]### Fixed, which the issue requests. I did not inspect the changelog file directly. That entry is documentation for the in-scope fix and is not a code change.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Simplify code
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Reviewing files that changed from the base of the PR and between b8fa4fe and 6cc2ab3.
Files selected for processing: 2
CHANGELOG.md
src/core/app/settings_apply.rs
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Looks good. The two new tests fail against main's implementation and pass here. The save path now matches the loader, preserves custom icons when cleared, and leaves padded label icons alone. Slim tests, default settings tests, and the slim/default/GUI clippy checks pass. I have no changes to request.
The reason will be displayed to describe this comment to others. Learn more.
Good catch on trimming early.
" " has a display width of 1 and isn't .is_empty(), so whitespace would slip past naive checks on both paths. Matching config.yml's trimming behavior and keeping the existing icon when blank makes total sense. LGTM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Settings stored icon values untrimmed while the
config.ymlloader trims them and skips empty values, so the two disagreed. Clearing Active Source Icon or List Highlight Icon saved"": the device-picker marker and the list cursor disappeared for the rest of the session, and the default quietly came back on the next launch. A padded one-cell icon like" » "was rejected by the width check even though the same value inconfig.ymlloads fine.apply_settings_changesnow trims each icon value once: the six one-cell icons are width-checked on the trimmed value and stored trimmed, and Active Source Icon / List Highlight Icon keep their current value when the trimmed value is empty, same as the loader. The free-form label icons (Liked, Shuffle, Paused, Repeat) are untouched, also matching the loader.Fixes #1062
Testing
cargo fmt --all -- --check— cleancargo clippy --no-default-features --features telemetry,tui -- -D warnings— clean (only the pre-existingvergenmanifest warning)cargo test --no-default-features --features telemetry,tui—1960 passed; 0 failedcargo test --no-default-features --features telemetry,tui settings_apply—8 passed, both new tests listedclearing_the_active_source_or_list_highlight_icon_keeps_the_current_icon(saved""instead of keeping●) anda_padded_one_cell_icon_is_saved_trimmed(rejected" » ")Additional notes
The Settings row still shows the cleared value after a save, the same as a rejected gauge icon today; reverting the row is out of scope per the issue.
💬 Questions or want to chat with other contributors? Join the spotatui Discord.
Summary by CodeRabbit