merge: TEXTEDIT command + TEXTEDITMODE sysvar (#130)

Merge PR #130 (KarimJerbi) and resolve review findings:

- Conflict (settings.rs): keep current persisted-settings layout, append
  texteditmode field.
- Conflict (command/mod.rs): keep both new CmdResult variants — main's
  live-entity ops and the PR's text-edit suspend/resume.
- Bug: invalid TEXTEDITMODE value no longer aborts via the Measurement
  arm; it now re-prompts with the error and stays active.
- Dedup: single parse_texteditmode() helper replaces the value parsing
  duplicated across commands.rs, settings.rs and textedit.rs.
- Strip trailing whitespace.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-06-21 12:05:54 +03:00
commit 8c48233dcf
11 changed files with 399 additions and 14 deletions

View file

@ -82,6 +82,8 @@ pub struct UserSettings {
/// Linked plugin source repositories (`owner/repo`) the marketplace installs
/// from.
pub plugin_repos: Vec<String>,
/// Controls whether the TEXTEDIT command repeats automatically (0 = Multiple, 1 = Single).
pub texteditmode: bool,
}
impl Default for UserSettings {
@ -105,6 +107,7 @@ impl Default for UserSettings {
default_assoc_prompted: false,
disabled_plugins: Vec::new(),
plugin_repos: Vec::new(),
texteditmode: false,
}
}
}
@ -138,6 +141,13 @@ impl UserSettings {
"osnap" => s.snap_enabled = val == "1",
"otrack" => s.otrack = val == "1",
"default_assoc_prompted" => s.default_assoc_prompted = val == "1",
"texteditmode" => {
if let Some(v) =
crate::modules::annotate::textedit::parse_texteditmode(val)
{
s.texteditmode = v;
}
}
"disabled_plugins" => {
s.disabled_plugins = val
.split(',')
@ -179,7 +189,7 @@ impl UserSettings {
.collect::<Vec<_>>()
.join(",");
let body = format!(
"dyn={}\northo={}\npolar={}\npolar_increment_deg={}\nosnap={}\notrack={}\ndefault_assoc_prompted={}\nsnap_modes={}\ndisabled_plugins={}\nplugin_repos={}\n",
"dyn={}\northo={}\npolar={}\npolar_increment_deg={}\nosnap={}\notrack={}\ndefault_assoc_prompted={}\nsnap_modes={}\ndisabled_plugins={}\nplugin_repos={}\ntexteditmode={}\n",
b(self.dyn_input),
b(self.ortho),
b(self.polar),
@ -190,6 +200,7 @@ impl UserSettings {
modes,
self.disabled_plugins.join(","),
self.plugin_repos.join(","),
self.texteditmode,
);
let _ = std::fs::write(path, body);
}