settings_ui: Only allow to reset a setting to default in the file in which it was customized (#40182)

Plus some other tiny visual adjustments.

Release Notes:

- N/A
This commit is contained in:
Danilo Leal 2025-10-14 11:14:16 -03:00 committed by GitHub
parent c5bbd556ea
commit 867b5df070
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 6 deletions

View file

@ -1 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none"><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.2" d="M2.6 5v3.6h3.6"/><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.2" d="M13.4 11A5.4 5.4 0 0 0 8 5.6a5.4 5.4 0 0 0-3.6 1.38L2.6 8.6"/></svg>
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6.125 9.25001L3 6.125L6.125 3" stroke="#C4CAD4" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M3 6.125H9.56251C10.0139 6.125 10.4609 6.21391 10.878 6.38666C11.295 6.55942 11.674 6.81262 11.9932 7.13182C12.3124 7.45102 12.5656 7.82997 12.7383 8.24703C12.9111 8.66408 13 9.11108 13 9.5625C13 10.0139 12.9111 10.4609 12.7383 10.878C12.5656 11.295 12.3124 11.674 11.9932 11.9932C11.674 12.3124 11.295 12.5656 10.878 12.7383C10.4609 12.9111 10.0139 13 9.56251 13H7.375" stroke="black" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 339 B

After

Width:  |  Height:  |  Size: 692 B

View file

@ -734,18 +734,19 @@ fn render_settings_item(
.when_some(
setting_item
.field
.reset_to_default_fn(&file, &found_in_file, cx),
.reset_to_default_fn(&file, &found_in_file, cx)
.filter(|_| file_set_in.as_ref() == Some(&file)),
|this, reset_to_default| {
this.child(
IconButton::new("reset-to-default-btn", IconName::Undo)
.icon_color(Color::Muted)
.size(ButtonSize::Compact)
.icon_size(IconSize::Small)
.tooltip(Tooltip::text("Reset to Default"))
.on_click({
move |_, _, cx| {
reset_to_default(cx);
}
})
.tooltip(Tooltip::text("Reset to default")),
}),
)
},
)
@ -754,7 +755,7 @@ fn render_settings_item(
|this, file_set_in| {
this.child(
Label::new(format!(
"set in {}",
" Modified in {}",
settings_window
.display_name(&file_set_in)
.expect("File name should exist")