forked from 1b-agent/opencadstudio-upstream
feat(clipboard): PASTESPEC pastes in a chosen format
PASTESPEC offers the formats on the clipboard: Objects and Block for objects copied in the application (the PASTECLIP and PASTEBLOCK paths), and Text for the system clipboard's text, placed as multi-line text in the current text style with its lines as paragraphs. Refs #645 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
4ffae00199
commit
b1d4c9bd9b
29 files changed
+242
-1
No files matched your search
@@ -6815,6 +6815,32 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
Message::PasteSpecial(text) => {
|
||||
let i = self.active_tab;
|
||||
let waiting = self.tabs[i]
|
||||
.active_cmd
|
||||
.as_ref()
|
||||
.is_some_and(|command| command.name() == "PASTESPEC");
|
||||
if !waiting {
|
||||
return Task::none();
|
||||
}
|
||||
match text.filter(|text| !text.trim().is_empty()) {
|
||||
Some(text) => {
|
||||
// Same prompt, one more option: swap without echoing it.
|
||||
self.tabs[i].active_cmd = Some(self.paste_special_command(i, Some(&text)));
|
||||
self.push_ucs_to_cmd(i);
|
||||
Task::none()
|
||||
}
|
||||
None if self.clipboard.is_empty() => {
|
||||
self.tabs[i].active_cmd = None;
|
||||
self.command_line
|
||||
.push_error(crate::tr!("clipboard", "no-supported-content").as_ref());
|
||||
Task::none()
|
||||
}
|
||||
None => Task::none(),
|
||||
}
|
||||
}
|
||||
|
||||
Message::SystemClipboardPaste(result) => {
|
||||
use super::SystemClipboardText as Text;
|
||||
|
||||
|
||||
Reference in new issue
Block a user