Skip to content

Commit b0b3519

Browse files
committed
fix: constellation preset swap no longer reads falsely dirty
The Constellation preset sets constellation_restamp_floor, but the field has no ProfileOverrides counterpart (capture can't read it back) and is not runtime-editable. Live capture projected it to its default while the preset resolved to its set value, so the dirty guard saw a phantom diff and prompted to discard when swapping away from constellations. Normalize it on both sides in project(), matching trail_modulation/respawn_config.
1 parent aa17c9b commit b0b3519

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

src/profile_overrides.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,13 @@ pub(crate) fn project(ov: &ProfileOverrides) -> Result<Canonical, String> {
891891
// carry None while capture carries Some.
892892
sim.respawn_config = Default::default();
893893

894+
// `constellation_restamp_floor` is set by the Constellation preset's sim-default
895+
// layer, but it has no `ProfileOverrides` field (capture can't read it back) and
896+
// is not runtime-editable. Capture therefore projects it to its default while a
897+
// clean Constellation swap resolves it to the preset value, making the swap read
898+
// falsely dirty. Normalize on BOTH sides so the guard stays blind to it.
899+
sim.constellation_restamp_floor = Default::default();
900+
894901
// Reproduce apply_color_aa_all priority EXACTLY ([P1]):
895902
// 1. full per-charset array if color_aa_all present,
896903
// 2. else the FULLY RESOLVED color_aa on the RESOLVED charset's slot over defaults.

src/terminal/state.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2849,6 +2849,21 @@ mod tests {
28492849
);
28502850
}
28512851

2852+
/// Repro: a freshly-applied Constellation preset must NOT read dirty.
2853+
#[test]
2854+
fn clean_constellation_swap_is_not_dirty() {
2855+
use crate::profile_overrides::ProfileOverrides;
2856+
let ov = ProfileOverrides {
2857+
preset: Some(Preset::Constellation),
2858+
..Default::default()
2859+
};
2860+
let (rs, sim) = clean_session(ov);
2861+
assert!(
2862+
!rs.is_dirty(&sim, rs.live_palette.clone(), rs.live_charset.clone()),
2863+
"a freshly-applied Constellation preset must not read dirty"
2864+
);
2865+
}
2866+
28522867
/// CLEAN `--color-aa subtle` session: the source carries a scalar `color_aa`,
28532868
/// live capture re-captures it, and project() must reproduce apply_color_aa_all
28542869
/// semantics (scalar on the RESOLVED charset slot over defaults) so the two

0 commit comments

Comments
 (0)