feat: add quick searchable layer command

This commit is contained in:
gianlucafiore committed 2026-10-08 23:17:03 -03:00
1 parent d0e4f4097d
commit a6307b3666
15 files changed
+637 -25

No files matched your search

+35
View File
@@ -2430,6 +2430,32 @@ pub struct PointPickContext {
pub aperture_px: f32,
}
/// One context-sensitive command-line autocomplete entry.
///
/// Normal command-name autocomplete only needs `value`. Interactive commands
/// may optionally attach CAD display metadata, allowing the shared suggestion
/// popup to render richer rows without knowing which command supplied them.
#[derive(Clone, Debug)]
pub struct CommandSuggestion {
pub value: String,
pub color: Option<codec::types::Color>,
pub visible: Option<bool>,
pub frozen: Option<bool>,
pub locked: Option<bool>,
}
impl CommandSuggestion {
pub fn plain(value: impl Into<String>) -> Self {
Self {
value: value.into(),
color: None,
visible: None,
frozen: None,
locked: None,
}
}
}
pub trait CadCommand: Send {
/// Preserve source appearance for commands that extract existing entities.
fn preserve_commit_style(&self) -> bool {
@@ -2471,6 +2497,15 @@ pub trait CadCommand: Send {
false
}
/// Context-sensitive autocomplete entries for the command line while this
/// command is active. Unlike normal command-name completion these entries
/// may be drawing data such as layer, block or style names.
///
/// Commands that do not provide contextual completion leave this empty.
fn text_suggestions(&self, _input: &str) -> Vec<CommandSuggestion> {
Vec::new()
}
/// Push the active coordinate frame in full precision. Geometry commands
/// use it for plane-local construction; inquiry and modify commands use it
/// for local deltas, angles and transformation axes.