forked from 1b-agent/opencadstudio-upstream
feat(ui): persistent literal-space toggle on the command line
'>' button after the Command: label turns the leading-'>' literal-space behavior into a mode: while on, Space stays in the line instead of submitting, until toggled off. State persists in settings.json; a hand-typed leading '>' still works for a single line. Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
c0499a1d3c
commit
7811add666
5 files changed
+87
-7
No files matched your search
@@ -1364,6 +1364,10 @@ pub enum Message {
|
||||
CommandHistoryNext,
|
||||
/// Toggle the dropdown listing the full command-line history.
|
||||
CommandHistoryToggle,
|
||||
/// Toggle the persistent literal-space mode (the `>` button): while on,
|
||||
/// every command line behaves as if it started with `>` — Space stays in
|
||||
/// the input instead of submitting. Saved in the user config.
|
||||
CommandLiteralToggle,
|
||||
/// Copy the full command-line history (every line) to the system
|
||||
/// clipboard as plain text — issue #232, so output can be pasted for
|
||||
/// debugging instead of screenshotted.
|
||||
|
||||
@@ -112,6 +112,10 @@ pub struct UserSettings {
|
||||
/// Linked plugin source repositories (`owner/repo`) the marketplace installs
|
||||
/// from.
|
||||
pub plugin_repos: Vec<String>,
|
||||
/// Command-line literal-space mode: when on, Space stays in the input
|
||||
/// instead of submitting (as if every line started with `>`), until the
|
||||
/// user toggles it back off.
|
||||
pub literal_spaces: bool,
|
||||
/// Controls whether the TEXTEDIT command repeats automatically (0 = Multiple, 1 = Single).
|
||||
pub texteditmode: bool,
|
||||
/// TEXTFILL: fill TrueType glyphs (true) or draw them hollow (false).
|
||||
@@ -143,6 +147,7 @@ impl Default for UserSettings {
|
||||
default_assoc_prompted: false,
|
||||
disabled_plugins: Vec::new(),
|
||||
plugin_repos: Vec::new(),
|
||||
literal_spaces: false,
|
||||
texteditmode: false,
|
||||
textfill: true,
|
||||
backup_on_save: true,
|
||||
|
||||
@@ -75,6 +75,7 @@ impl OpenCADStudio {
|
||||
v
|
||||
},
|
||||
plugin_repos: self.plugin_repos.clone(),
|
||||
literal_spaces: self.command_line.literal_spaces,
|
||||
texteditmode: self.texteditmode,
|
||||
textfill: crate::scene::text::sdf_atlas::textfill(),
|
||||
backup_on_save: self.backup_on_save,
|
||||
@@ -96,6 +97,7 @@ impl OpenCADStudio {
|
||||
self.default_assoc_prompted = s.default_assoc_prompted;
|
||||
self.disabled_plugins = s.disabled_plugins.iter().cloned().collect();
|
||||
self.plugin_repos = s.plugin_repos.clone();
|
||||
self.command_line.literal_spaces = s.literal_spaces;
|
||||
self.texteditmode = s.texteditmode;
|
||||
crate::scene::text::sdf_atlas::set_textfill(s.textfill);
|
||||
self.backup_on_save = s.backup_on_save;
|
||||
|
||||
+12
-5
@@ -770,7 +770,7 @@ impl OpenCADStudio {
|
||||
// the submit path, which tokenises multi-token lines — so a typed
|
||||
// token, a pasted `LINE 0,0 10,10`, or API-fed text all run their
|
||||
// spaces as step separators. A leading `>` keeps spaces literal.
|
||||
if !s.starts_with('>') && s.contains(' ') {
|
||||
if !self.command_line.literal_spaces && !s.starts_with('>') && s.contains(' ') {
|
||||
self.command_line.input = s;
|
||||
return self.update(Message::CommandSubmit);
|
||||
}
|
||||
@@ -856,6 +856,12 @@ impl OpenCADStudio {
|
||||
Task::none()
|
||||
}
|
||||
|
||||
Message::CommandLiteralToggle => {
|
||||
self.command_line.literal_spaces = !self.command_line.literal_spaces;
|
||||
self.save_config();
|
||||
self.focus_cmd_input()
|
||||
}
|
||||
|
||||
Message::CommandHistoryToggle => {
|
||||
self.command_line.toggle_history();
|
||||
// On open, snapshot the current log into the read-only editor
|
||||
@@ -924,10 +930,11 @@ impl OpenCADStudio {
|
||||
self.mtext_type(" ");
|
||||
return Task::none();
|
||||
}
|
||||
// A leading `>` puts the command line in "literal space" mode so
|
||||
// the user can type arguments that contain spaces; otherwise
|
||||
// Space works like Enter. The `>` is stripped on submit.
|
||||
if self.command_line.input.starts_with('>') {
|
||||
// A leading `>` (or the persistent `>` toggle) puts the command
|
||||
// line in "literal space" mode so the user can type arguments
|
||||
// that contain spaces; otherwise Space works like Enter. The
|
||||
// typed `>` is stripped on submit.
|
||||
if self.command_line.literal_spaces || self.command_line.input.starts_with('>') {
|
||||
self.command_line.input.push(' ');
|
||||
return Task::none();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user