diff --git a/crates/nyaterm-desktop/src/features/settings/settings_runtime/draft.rs b/crates/nyaterm-desktop/src/features/settings/settings_runtime/draft.rs index 22678eaf7..f312688d5 100644 --- a/crates/nyaterm-desktop/src/features/settings/settings_runtime/draft.rs +++ b/crates/nyaterm-desktop/src/features/settings/settings_runtime/draft.rs @@ -1023,6 +1023,39 @@ mod tests { ); } + /// Editing only the word separators must still be written when the draft is applied. + /// + /// The box used to update memory and nothing else, so no persistence domain was + /// marked dirty and applying the draft saved no interaction settings at all. The + /// assertion is on disk for the same reason as the header-status test above. + #[test] + fn applying_a_draft_persists_word_separators() { + const SEPARATORS: &str = " ()[]{}\"':=,;|&<>"; + let mut cx = TestAppContext::single(); + let _test_app_cleanup = crate::test_support::TestAppCleanup::new(&cx); + let app = app(&mut cx); + let stored = |app: &gpui::Entity, cx: &mut TestAppContext| { + cx.update_entity(app, |app, _| { + app.store_blocking_client() + .request_fn(nyaterm_store::StoreDomain::Settings, |store| { + store.load_app_settings_summary() + }) + }) + .expect("load stored settings") + .interaction_word_separators + }; + assert_ne!(stored(&app, &mut cx), SEPARATORS, "fixture baseline"); + + cx.update_entity(&app, |app, cx| { + app.begin_settings_draft(cx); + app.apply_interaction_word_separators(SEPARATORS.to_string(), cx); + app.apply_settings_draft(false, cx); + }); + cx.run_until_parked(); + + assert_eq!(stored(&app, &mut cx), SEPARATORS); + } + #[test] fn canceling_a_draft_restores_ui_typography_source() { let mut cx = TestAppContext::single(); diff --git a/crates/nyaterm-desktop/src/features/settings/settings_runtime/general_interaction.rs b/crates/nyaterm-desktop/src/features/settings/settings_runtime/general_interaction.rs index a48f6ea65..de7adaa11 100644 --- a/crates/nyaterm-desktop/src/features/settings/settings_runtime/general_interaction.rs +++ b/crates/nyaterm-desktop/src/features/settings/settings_runtime/general_interaction.rs @@ -296,7 +296,9 @@ impl NyaTermApp { cx: &mut Context, ) { self.settings.set_interaction_word_separators(text); - cx.notify(); + // Without this, a draft never marks the Interaction domain dirty: applying it + // writes nothing and cancelling it silently restores the old separators. + self.save_interaction_settings(cx); } pub(in crate::features) fn save_interaction_settings(&mut self, cx: &mut Context) {