mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-20 09:23:10 +01:00
train: #8512
This commit is contained in:
commit
fe7580546f
12 files changed
+514
-16
No files matched your search
@@ -171,6 +171,8 @@ impl VectorcraftApp {
|
||||
forwarded_modifiers: None,
|
||||
forwarded_modifiers_held: false,
|
||||
forwarded_frame: false,
|
||||
forwarded_clipboard: false,
|
||||
forwarded_presses: vec![],
|
||||
synthetic_modifiers: false,
|
||||
ime_marked: None,
|
||||
ime_context: Default::default(),
|
||||
|
||||
@@ -214,6 +214,8 @@ impl VectorcraftApp {
|
||||
raw.events.insert(0, egui::Event::ModifiersChanged(self.host_modifiers));
|
||||
}
|
||||
self.forwarded_frame = !self.forwarded.is_empty();
|
||||
self.forwarded_clipboard = self.forwarded.iter().any(|e| matches!(e, egui::Event::Copy | egui::Event::Cut));
|
||||
self.forwarded_presses = self.forwarded.iter().filter(|e| matches!(e, egui::Event::Key { pressed: true, .. })).cloned().collect();
|
||||
if !self.forwarded.is_empty() {
|
||||
if let Some(m) = self.forwarded_modifiers.take() {
|
||||
raw.events.push(egui::Event::ModifiersChanged(m));
|
||||
|
||||
@@ -308,6 +308,13 @@ pub struct VectorcraftApp {
|
||||
/// This host iteration's input carries forwarded keys: they are the main window's although
|
||||
/// its OS window doesn't have the keyboard (see `shortcuts::handle`).
|
||||
pub(crate) forwarded_frame: bool,
|
||||
/// The forwarded keys of this host iteration hold a Copy or Cut: it copies the art, not text
|
||||
/// selected in this window's labels (see `shortcuts::handle_clipboard`).
|
||||
pub(crate) forwarded_clipboard: bool,
|
||||
/// The key presses among this host iteration's forwarded keys: a Copy or Cut one of them runs
|
||||
/// (F3 and F2 off macOS) copies the art, not text selected in this window's labels (see
|
||||
/// `shortcuts::clipboard_key_to_labels`).
|
||||
pub(crate) forwarded_presses: Vec<egui::Event>,
|
||||
/// Synthetic input set the modifiers egui holds (see [`Self::raw_input_hook`]).
|
||||
synthetic_modifiers: bool,
|
||||
/// The marked text the system IME last sent (`None` once it commits or clears). When the Type
|
||||
|
||||
@@ -111,10 +111,24 @@ pub(super) fn field_event(app: &mut VectorcraftApp, id: &str) -> Option<egui::Ev
|
||||
/// key presses, see [`crate::native_menu`]). While a text field has the keyboard, Select All, Cut,
|
||||
/// Copy and Paste act on the field's text, as their keys do. While its keys select every artboard
|
||||
/// ([`crate::panels::artboards::selects_all`]), Select All does too. Everything else (and those
|
||||
/// commands with no field focused) goes to [`invoke`].
|
||||
/// commands with no field focused) goes to [`invoke`]. With text selected in a label (a Document
|
||||
/// Info value), Copy and Cut copy that text, as their keys do ([`crate::shortcuts::leave_to_labels`]).
|
||||
pub fn invoke_from_system_menu(app: &mut VectorcraftApp, ctx: &egui::Context, id: &str, p: Value) {
|
||||
let label_event = match id {
|
||||
"edit.copy" => Some(("edit.copy", egui::Event::Copy)),
|
||||
"edit.cut" => Some(("edit.cut", egui::Event::Cut)),
|
||||
_ => None,
|
||||
};
|
||||
match focused_text_field(ctx).and_then(|f| Some((f, field_event(app, id)?))) {
|
||||
Some((field, e)) => to_field(ctx, field, e),
|
||||
None if label_event.as_ref().is_some_and(|(id, _)| crate::shortcuts::leave_to_labels(ctx, id)) => {
|
||||
if let Some((_, e)) = label_event {
|
||||
ctx.input_mut(|i| i.events.push(e));
|
||||
}
|
||||
// The labels' text replaces the formats of an earlier Copy or Cut not written yet, even
|
||||
// in a frame whose keys are not this window's.
|
||||
app.drop_unwritten_formats();
|
||||
}
|
||||
None if id == "select.all" && crate::panels::artboards::selects_all(app, ctx) => crate::panels::artboards::select_all(app),
|
||||
None => invoke(app, id, p),
|
||||
}
|
||||
|
||||
@@ -1434,8 +1434,13 @@ pub(crate) fn close_overlays_for_modal(app: &mut VectorcraftApp, ctx: &egui::Con
|
||||
/// window's shortcuts, tool keys and clipboard on its next frame ([`VectorcraftApp::raw_input_hook`]).
|
||||
/// craft-ui forwards nothing while a field in that window has the keyboard. A field of the main
|
||||
/// window loses it, as a click elsewhere in one window would take it. A floating document's OS
|
||||
/// window forwards its keys here too ([`crate::doc_windows`]).
|
||||
pub(crate) fn forward_keys(app: &mut VectorcraftApp, ctx: &egui::Context, events: Vec<egui::Event>, modifiers: Option<egui::Modifiers>) {
|
||||
/// window forwards its keys here too ([`crate::doc_windows`]). A Copy or Cut whose text a label of
|
||||
/// that window copied stays there.
|
||||
pub(crate) fn forward_keys(app: &mut VectorcraftApp, ctx: &egui::Context, mut events: Vec<egui::Event>, modifiers: Option<egui::Modifiers>) {
|
||||
if crate::shortcuts::take_copied_in_window(ctx) {
|
||||
events.retain(|e| !matches!(e, egui::Event::Copy | egui::Event::Cut));
|
||||
app.drop_unwritten_formats();
|
||||
}
|
||||
if events.is_empty() {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -12,11 +12,16 @@ use vectorcraft_tools::{Mods, SurroundingUnit, ToolKey};
|
||||
use crate::VectorcraftApp;
|
||||
|
||||
mod held_tool;
|
||||
mod labels;
|
||||
mod paste;
|
||||
mod presentation;
|
||||
mod typing;
|
||||
|
||||
pub(crate) use held_tool::{HeldTool, note_tool_use};
|
||||
#[cfg(test)]
|
||||
pub(crate) use labels::note_copied_in_window;
|
||||
pub(crate) use labels::{leave_to_labels, take_copied_in_window};
|
||||
use labels::{left_to_labels, take_command_after_labels, watch_label_copies};
|
||||
use paste::unclip_chords;
|
||||
pub(crate) use paste::{PasteChord, paste_command};
|
||||
pub(crate) use presentation::presentation_step;
|
||||
@@ -193,6 +198,12 @@ pub fn handle(app: &mut VectorcraftApp, ctx: &egui::Context) {
|
||||
return;
|
||||
}
|
||||
ctx.input(|i| crate::shortcut_editor::note_backtick_text(&i.events));
|
||||
// A Copy or Cut the last pass left to labels that copied nothing runs now, whatever this
|
||||
// frame's keys do.
|
||||
watch_label_copies(ctx);
|
||||
if let Some(id) = take_command_after_labels(ctx) {
|
||||
crate::menus::invoke(app, id, json!({}));
|
||||
}
|
||||
note_key_surfaces(app, ctx);
|
||||
forget_opening_key(ctx);
|
||||
let focused = ctx.input(|input| input.focused) || app.forwarded_frame && ctx.viewport_id() == egui::ViewportId::ROOT;
|
||||
@@ -332,7 +343,11 @@ pub fn handle(app: &mut VectorcraftApp, ctx: &egui::Context) {
|
||||
crate::ime::controls_without_editor(app, ctx);
|
||||
return;
|
||||
}
|
||||
ctx.input_mut(unclip_chords);
|
||||
// The Copy or Cut the menu bar left to the labels came from no key: unclipped, the menu's Cut
|
||||
// would become a plain X press (Toggle Fill/Stroke Focus).
|
||||
if left_to_labels(ctx).is_none() {
|
||||
ctx.input_mut(unclip_chords);
|
||||
}
|
||||
// Tab is ours when no field has the keyboard (it shows and hides the panels, or goes to the
|
||||
// Type tool): left to egui, it would also move the focus on to a field, and every key after it
|
||||
// would count as typing.
|
||||
@@ -348,7 +363,7 @@ pub fn handle(app: &mut VectorcraftApp, ctx: &egui::Context) {
|
||||
return;
|
||||
}
|
||||
crate::ime::controls_without_editor(app, ctx);
|
||||
handle_clipboard(app, ctx, textless_paste);
|
||||
let to_labels = handle_clipboard(app, ctx, textless_paste);
|
||||
if busy {
|
||||
busy_tool_keys(app, ctx, view);
|
||||
return;
|
||||
@@ -368,10 +383,12 @@ pub fn handle(app: &mut VectorcraftApp, ctx: &egui::Context) {
|
||||
};
|
||||
// An Escape that ended a ruler-origin drag or floating Tools move runs no command bound to it.
|
||||
let gesture_escape = |chord: &craft_keymap::Chord| escape_ended_gesture && chord.is_plain() && chord.key == craft_keymap::Key::Escape;
|
||||
// A Copy or Cut left to the labels runs neither command from the keymap.
|
||||
let labels_clip = |hit: &Hit| to_labels && matches!(hit.command.id.as_str(), "edit.copy" | "edit.cut");
|
||||
let hits = dispatch(app, ctx, |hit| {
|
||||
let chord = &hit.trigger.chord;
|
||||
let shifted_punctuation = chord.mods.shift && chord.key.name().chars().all(|c| !c.is_alphanumeric());
|
||||
!(chord.is_plain() && types_text(chord.key) && !shifted_punctuation || row_key(chord) || gesture_escape(chord))
|
||||
!(chord.is_plain() && types_text(chord.key) && !shifted_punctuation || row_key(chord) || gesture_escape(chord) || labels_clip(hit))
|
||||
});
|
||||
let ran = !hits.is_empty();
|
||||
for c in hits {
|
||||
@@ -738,8 +755,9 @@ fn nudge_and_clear(app: &mut VectorcraftApp, ctx: &egui::Context, rows_keys: boo
|
||||
}
|
||||
}
|
||||
|
||||
/// Route clipboard events to the system clipboard or the app's rich-format paste path.
|
||||
fn handle_clipboard(app: &mut VectorcraftApp, ctx: &egui::Context, textless_paste: Option<Modifiers>) {
|
||||
/// Route clipboard events to the system clipboard or the app's rich-format paste path. → whether
|
||||
/// a Copy or Cut is left to the labels, so no shortcut runs it.
|
||||
fn handle_clipboard(app: &mut VectorcraftApp, ctx: &egui::Context, textless_paste: Option<Modifiers>) -> bool {
|
||||
// A clipboard image (eframe's `clipboard` feature, 0.37): the host's text paste path never
|
||||
// carries it. With the app's rich-format `SystemClipboard`, it is only the signal that the
|
||||
// clipboard holds no text — the next tick invokes Paste, whose `adopt_system_clipboard` reads
|
||||
@@ -788,14 +806,29 @@ fn handle_clipboard(app: &mut VectorcraftApp, ctx: &egui::Context, textless_past
|
||||
let held = ctx.input(|i| i.modifiers);
|
||||
app.clipboard_in = Some(Flavour { mime: vectorcraft_engine::cmd::clipboard::PNG, data: png });
|
||||
crate::menus::invoke(app, paste_command(held), json!({}));
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
// Clipboard keys arrive as events, not key presses; the chord held says which paste.
|
||||
// Clipboard keys arrive as events, not key presses; the chord held says which paste. Copy and
|
||||
// Cut with text selected in a label copy that text ([`leave_to_labels`]), unless another window
|
||||
// sent them on (a floating document's): those copy the art. The menu bar's Copy and Cut have
|
||||
// left theirs to the labels already and dropped the unwritten formats; dropping them again
|
||||
// here does nothing more.
|
||||
let mut clip = vec![];
|
||||
let forwarded = app.forwarded_clipboard && ctx.viewport_id() == egui::ViewportId::ROOT;
|
||||
let to_labels =
|
||||
|e: egui::Event, id| ctx.input(|i| i.events.contains(&e)) && (left_to_labels(ctx) == Some(id) || (!forwarded && leave_to_labels(ctx, id)));
|
||||
let (labels_copy, labels_cut) = (to_labels(egui::Event::Copy, "edit.copy"), to_labels(egui::Event::Cut, "edit.cut"));
|
||||
// The labels' text, or the art copied in the next pass when they copy nothing, replaces what an
|
||||
// earlier Copy or Cut has not written yet.
|
||||
if labels_copy || labels_cut {
|
||||
app.drop_unwritten_formats();
|
||||
}
|
||||
ctx.input_mut(|i| {
|
||||
let held = i.modifiers;
|
||||
i.events.retain(|e| {
|
||||
let (id, text) = match e {
|
||||
egui::Event::Copy if labels_copy => return true,
|
||||
egui::Event::Cut if labels_cut => return true,
|
||||
egui::Event::Copy => ("edit.copy", None),
|
||||
egui::Event::Cut => ("edit.cut", None),
|
||||
egui::Event::Paste(t) => (paste_command(held), Some(t.clone())),
|
||||
@@ -815,6 +848,34 @@ fn handle_clipboard(app: &mut VectorcraftApp, ctx: &egui::Context, textless_past
|
||||
app.clipboard_in = text.map(|t| Flavour { mime: TEXT, data: t.into_bytes() });
|
||||
crate::menus::invoke(app, id, json!({}));
|
||||
}
|
||||
labels_copy || labels_cut
|
||||
}
|
||||
|
||||
/// Copy or Cut (`id`) on a key that egui does not send as a Copy or Cut event (F3 and F2 off
|
||||
/// macOS, a key of the user's own): with text selected in a label, the labels copy it, as they do
|
||||
/// for Cmd/Ctrl+C and X ([`leave_to_labels`]) (→ true). When a key another window sent on in this
|
||||
/// frame (a floating document's) runs `id`, the art is copied.
|
||||
fn clipboard_key_to_labels(app: &mut VectorcraftApp, ctx: &egui::Context, id: &str) -> bool {
|
||||
let (command, event) = match id {
|
||||
"edit.copy" => ("edit.copy", egui::Event::Copy),
|
||||
"edit.cut" => ("edit.cut", egui::Event::Cut),
|
||||
_ => return false,
|
||||
};
|
||||
if ctx.viewport_id() == egui::ViewportId::ROOT && forwarded_key_runs(app, command) || !leave_to_labels(ctx, command) {
|
||||
return false;
|
||||
}
|
||||
ctx.input_mut(|i| i.events.push(event));
|
||||
app.drop_unwritten_formats();
|
||||
true
|
||||
}
|
||||
|
||||
/// Does a key press another window sent on in this frame run command `id`?
|
||||
fn forwarded_key_runs(app: &VectorcraftApp, id: &str) -> bool {
|
||||
let mirror = crate::shortcut_editor::current();
|
||||
let platform = crate::keymap::platform();
|
||||
app.forwarded_presses.iter().filter_map(|e| craft_keymap::KeyInput::from_egui(e, platform)).any(|input| {
|
||||
app.dispatcher.layout().candidates(&input).iter().any(|chord| crate::keymap::lookup(&mirror.keymap, chord).is_some_and(|c| c.id == id))
|
||||
})
|
||||
}
|
||||
|
||||
/// Route arrows, digits and letters to a tool while a gesture is active.
|
||||
@@ -1082,6 +1143,8 @@ fn run_hit(app: &mut VectorcraftApp, ctx: &egui::Context, c: &CommandRef) {
|
||||
// With the Artboard tool, Select All's keys after a click on an Artboards panel row select
|
||||
// every artboard instead of the art.
|
||||
crate::panels::artboards::select_all(app);
|
||||
} else if clipboard_key_to_labels(app, ctx, &c.id) {
|
||||
// The labels copy their selected text at the end of the pass.
|
||||
} else {
|
||||
match menu_target(app, c) {
|
||||
Some(Ok((id, p))) => crate::menus::invoke(app, &id, p),
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
use egui::text_selection::LabelSelectionState;
|
||||
|
||||
/// The Copy or Cut command left to the labels of viewport `viewport` in this pass.
|
||||
fn waiting_id(viewport: egui::ViewportId) -> egui::Id {
|
||||
egui::Id::unique(("copy-waits-for-labels", viewport))
|
||||
}
|
||||
|
||||
/// The Copy or Cut command to run in the next pass: the labels it was left to copied nothing.
|
||||
fn after_labels_id() -> egui::Id {
|
||||
egui::Id::unique("copy-after-labels")
|
||||
}
|
||||
|
||||
/// Set when a label in a window of its own (a floating panel's) copied its selected text: the
|
||||
/// window then sends the Copy or Cut on to the main window ([`crate::panel_docking::forward_keys`]).
|
||||
/// It lasts until the main window's next pass starts.
|
||||
fn copied_in_window_id() -> egui::Id {
|
||||
egui::Id::unique("labels-copied-in-window")
|
||||
}
|
||||
|
||||
/// Watch the labels' copies from the next pass on ([`leave_to_labels`]). egui runs a plugin only
|
||||
/// from the pass after the one that adds it.
|
||||
pub(super) fn watch_label_copies(ctx: &egui::Context) {
|
||||
if ctx.plugin_opt::<CopyAfterLabels>().is_none() {
|
||||
ctx.add_plugin(CopyAfterLabels);
|
||||
}
|
||||
}
|
||||
|
||||
/// Copy or Cut `command` (`edit.copy`, `edit.cut`) while text is selected in a label, such as a
|
||||
/// Document Info value or an Info panel readout: egui copies that text when the Copy or Cut event
|
||||
/// reaches the labels, so the event is left in the input for them (→ true). When no label of this
|
||||
/// viewport copies anything in this pass (the selected text is in another window, or its label is
|
||||
/// not drawn), `command` runs in the next pass ([`take_command_after_labels`]).
|
||||
pub(crate) fn leave_to_labels(ctx: &egui::Context, command: &'static str) -> bool {
|
||||
let selected = ctx.with_plugin(|s: &mut LabelSelectionState| s.has_selection()).unwrap_or(false);
|
||||
if !selected || ctx.plugin_opt::<CopyAfterLabels>().is_none() {
|
||||
return false;
|
||||
}
|
||||
let id = waiting_id(ctx.viewport_id());
|
||||
ctx.data_mut(|d| d.insert_temp(id, command));
|
||||
true
|
||||
}
|
||||
|
||||
/// The Copy or Cut command left to this viewport's labels in this pass, if any.
|
||||
pub(super) fn left_to_labels(ctx: &egui::Context) -> Option<&'static str> {
|
||||
let id = waiting_id(ctx.viewport_id());
|
||||
ctx.data(|d| d.get_temp::<&'static str>(id))
|
||||
}
|
||||
|
||||
/// The Copy or Cut command an earlier pass left to labels that copied nothing.
|
||||
pub(super) fn take_command_after_labels(ctx: &egui::Context) -> Option<&'static str> {
|
||||
ctx.data_mut(|d| d.remove_temp::<&'static str>(after_labels_id()))
|
||||
}
|
||||
|
||||
/// Note that a floating panel's window copied its label text, as [`CopyAfterLabels`] does.
|
||||
#[cfg(test)]
|
||||
pub(crate) fn note_copied_in_window(ctx: &egui::Context) {
|
||||
ctx.data_mut(|d| d.insert_temp(copied_in_window_id(), true));
|
||||
}
|
||||
|
||||
/// Did a label in another window copy its selected text since the last call? The Copy or Cut that
|
||||
/// window sends on is then its own and copies nothing more.
|
||||
pub(crate) fn take_copied_in_window(ctx: &egui::Context) -> bool {
|
||||
ctx.data_mut(|d| d.remove_temp::<bool>(copied_in_window_id())).unwrap_or(false)
|
||||
}
|
||||
|
||||
/// Runs after egui's label text selection at the end of each pass, when the labels have copied
|
||||
/// their selected text.
|
||||
struct CopyAfterLabels;
|
||||
|
||||
impl egui::Plugin for CopyAfterLabels {
|
||||
fn debug_name(&self) -> &'static str {
|
||||
"CopyAfterLabels"
|
||||
}
|
||||
|
||||
/// The windows of their own run their passes inside the main window's pass, and their Copy or
|
||||
/// Cut is sent on in that pass: a copy noted before it is not theirs.
|
||||
fn on_begin_pass(&mut self, ui: &mut egui::Ui) {
|
||||
if ui.ctx().viewport_id() == egui::ViewportId::ROOT {
|
||||
take_copied_in_window(ui.ctx());
|
||||
}
|
||||
}
|
||||
|
||||
fn on_end_pass(&mut self, ui: &mut egui::Ui) {
|
||||
let ctx = ui.ctx();
|
||||
let copied = ctx.output(|o| o.commands.iter().any(|c| matches!(c, egui::OutputCommand::CopyText(_))));
|
||||
// A field with the keyboard copies its own text, and its window sends nothing on.
|
||||
if ctx.viewport_id() != egui::ViewportId::ROOT
|
||||
&& copied
|
||||
&& ctx.memory(|m| m.focused().is_none())
|
||||
&& ctx.input(|i| i.events.iter().any(|e| matches!(e, egui::Event::Copy | egui::Event::Cut)))
|
||||
{
|
||||
ctx.data_mut(|d| d.insert_temp(copied_in_window_id(), true));
|
||||
}
|
||||
let id = waiting_id(ctx.viewport_id());
|
||||
let Some(command) = ctx.data_mut(|d| d.remove_temp::<&'static str>(id)) else {
|
||||
return;
|
||||
};
|
||||
if !copied {
|
||||
ctx.data_mut(|d| d.insert_temp(after_labels_id(), command));
|
||||
ctx.request_repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1323,6 +1323,82 @@ fn copy_and_paste_events_use_the_system_clipboard() {
|
||||
assert_eq!(app.session.doc().unwrap().doc.layers[0].children().unwrap().len(), 8);
|
||||
}
|
||||
|
||||
/// #8432: a window of its own (a floating panel's) notes that its labels copied the text a Copy
|
||||
/// asked for, so that the Copy it sends on to the main window copies nothing more. A field with
|
||||
/// the keyboard copying its own text is not noted, and a note lasts only until the main window's
|
||||
/// next pass, so it never drops a later Copy from another window.
|
||||
#[test]
|
||||
fn a_window_notes_only_its_labels_copies_until_the_next_main_window_pass() {
|
||||
let ctx = egui::Context::default();
|
||||
watch_label_copies(&ctx);
|
||||
let main_window_pass = || ctx.run_ui(egui::RawInput::default(), |_| {}).drop_without_applying_deltas();
|
||||
main_window_pass();
|
||||
let window = egui::ViewportId::from_hash_of("floating panel");
|
||||
let mut window_input = egui::RawInput { viewport_id: window, events: vec![egui::Event::Copy], ..Default::default() };
|
||||
window_input.viewports.insert(window, egui::ViewportInfo { parent: Some(egui::ViewportId::ROOT), ..Default::default() });
|
||||
// `field`: the text is copied by a field with the keyboard instead of a label.
|
||||
let copy_in_window = |field: bool| {
|
||||
ctx.run_ui(window_input.clone(), |ui| {
|
||||
if field {
|
||||
let mut text = String::from("234 pt");
|
||||
ui.text_edit_singleline(&mut text).request_focus();
|
||||
}
|
||||
ui.ctx().copy_text("234 pt".into());
|
||||
})
|
||||
.drop_without_applying_deltas();
|
||||
};
|
||||
copy_in_window(false);
|
||||
assert!(take_copied_in_window(&ctx), "the window's label copied the text");
|
||||
assert!(!take_copied_in_window(&ctx), "once");
|
||||
copy_in_window(false);
|
||||
main_window_pass();
|
||||
assert!(!take_copied_in_window(&ctx), "the main window's next pass forgets the note");
|
||||
copy_in_window(true);
|
||||
assert!(!take_copied_in_window(&ctx), "a field's copy is not noted");
|
||||
}
|
||||
|
||||
/// #8432: text selected by a drag across a label in a window of its own, then copied there, is
|
||||
/// noted as that window's labels' copy.
|
||||
#[test]
|
||||
fn a_window_notes_a_copy_of_text_dragged_across_its_label() {
|
||||
let ctx = egui::Context::default();
|
||||
watch_label_copies(&ctx);
|
||||
ctx.run_ui(egui::RawInput::default(), |_| {}).drop_without_applying_deltas();
|
||||
let window = egui::ViewportId::from_hash_of("floating panel");
|
||||
let rect = std::cell::Cell::new(egui::Rect::NOTHING);
|
||||
let time = std::cell::Cell::new(0.0);
|
||||
// One pass of the window with `events`: the texts it copied.
|
||||
let pass = |events: Vec<egui::Event>| {
|
||||
time.set(time.get() + 0.1);
|
||||
let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(400.0, 200.0));
|
||||
let mut input = egui::RawInput { viewport_id: window, events, time: Some(time.get()), screen_rect: Some(screen), ..Default::default() };
|
||||
input.viewports.insert(window, egui::ViewportInfo { parent: Some(egui::ViewportId::ROOT), ..Default::default() });
|
||||
let out = ctx.run_ui(input, |ui| rect.set(ui.label("234 pt").rect));
|
||||
let copied: Vec<String> = out
|
||||
.platform_output
|
||||
.commands
|
||||
.iter()
|
||||
.filter_map(|c| if let egui::OutputCommand::CopyText(t) = c { Some(t.clone()) } else { None })
|
||||
.collect();
|
||||
out.drop_without_applying_deltas();
|
||||
copied
|
||||
};
|
||||
pass(vec![]);
|
||||
let (from, to) = (rect.get().left_center() + egui::vec2(1.0, 0.0), rect.get().right_center() - egui::vec2(1.0, 0.0));
|
||||
let button =
|
||||
|at, pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: egui::Modifiers::NONE };
|
||||
pass(vec![egui::Event::PointerMoved(from)]);
|
||||
pass(vec![button(from, true)]);
|
||||
for k in 1..=4 {
|
||||
pass(vec![egui::Event::PointerMoved(from + (to - from) * k as f32 / 4.0)]);
|
||||
}
|
||||
pass(vec![button(to, false)]);
|
||||
pass(vec![]);
|
||||
assert!(!take_copied_in_window(&ctx), "nothing copied yet");
|
||||
assert_eq!(pass(vec![egui::Event::Copy]), ["234 pt"], "the label copies its selected text");
|
||||
assert!(take_copied_in_window(&ctx), "the window's label copy is noted");
|
||||
}
|
||||
|
||||
/// While a grid is dragged out, ↑/↓ change its rows and ←/→ its columns.
|
||||
#[test]
|
||||
fn arrows_while_dragging_a_grid_change_its_rows_and_columns() {
|
||||
|
||||
@@ -343,11 +343,17 @@ impl VectorcraftApp {
|
||||
/// dropped, and the system clipboard keeps that copy.
|
||||
pub(crate) fn drop_formats_after_egui_copy(&mut self, ctx: &egui::Context) {
|
||||
let copied = ctx.output(|o| o.commands.iter().any(|c| matches!(c, egui::OutputCommand::CopyText(_) | egui::OutputCommand::CopyImage(_))));
|
||||
let publishing = &mut self.clipboard_publishing;
|
||||
if copied {
|
||||
publishing.unwritten = None;
|
||||
self.drop_unwritten_formats();
|
||||
}
|
||||
if copied && publishing.pending {
|
||||
}
|
||||
|
||||
/// Drop the formats of an earlier Copy or Cut that are not written yet: something else is
|
||||
/// being copied (text through egui, the text selected in a label).
|
||||
pub(crate) fn drop_unwritten_formats(&mut self) {
|
||||
let publishing = &mut self.clipboard_publishing;
|
||||
publishing.unwritten = None;
|
||||
if publishing.pending {
|
||||
publishing.latest.fetch_add(1, Ordering::SeqCst);
|
||||
publishing.pending = false;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
//! Select All (Cmd+A) follows the keyboard, from the window and from the system menu bar (macOS):
|
||||
//! a focused text field selects its own text, the Type tool editing selects the text being edited,
|
||||
//! the Artboards panel selects every artboard after a click on one of its rows with the Artboard
|
||||
//! tool, and only otherwise are all the objects selected.
|
||||
//! tool, and only otherwise are all the objects selected. The clipboard keys follow it too: Copy
|
||||
//! and Cut copy the text selected in a field or in a panel's label before the art.
|
||||
|
||||
use egui::{Event, Key, Modifiers, PointerButton, Pos2, Rect, vec2};
|
||||
use serde_json::json;
|
||||
@@ -14,6 +15,8 @@ struct App {
|
||||
app: VectorcraftApp,
|
||||
ctx: egui::Context,
|
||||
time: f64,
|
||||
/// The window has the keyboard.
|
||||
focused: bool,
|
||||
}
|
||||
|
||||
impl App {
|
||||
@@ -23,7 +26,7 @@ impl App {
|
||||
app.run("file.new", json!({"width": 400, "height": 300})).unwrap();
|
||||
app.run("shape.rectangle", json!({"x": 200, "y": 150, "width": 20, "height": 20})).unwrap();
|
||||
app.run("shape.rectangle", json!({"x": 20, "y": 20, "width": 37, "height": 40})).unwrap();
|
||||
let mut a = Self { app, ctx: egui::Context::default(), time: 0.0 };
|
||||
let mut a = Self { app, ctx: egui::Context::default(), time: 0.0, focused: true };
|
||||
for _ in 0..3 {
|
||||
a.frame(vec![]);
|
||||
}
|
||||
@@ -34,12 +37,19 @@ impl App {
|
||||
/// host dispatches it before the app's logic.
|
||||
fn frame_with(&mut self, events: Vec<Event>, menu: Option<&str>) -> egui::FullOutput {
|
||||
self.time += 0.1;
|
||||
let raw = egui::RawInput {
|
||||
let mut raw = egui::RawInput {
|
||||
events,
|
||||
time: Some(self.time),
|
||||
focused: self.focused,
|
||||
screen_rect: Some(Rect::from_min_size(Pos2::ZERO, vec2(1600.0, 850.0))),
|
||||
..Default::default()
|
||||
};
|
||||
// As the hosts do: the keys another window sent on join this frame's input, and the frame
|
||||
// after them goes back to the keyboard's modifiers.
|
||||
let app = &self.app;
|
||||
if !app.forwarded.is_empty() || app.forwarded_frame || app.forwarded_modifiers_held {
|
||||
self.app.raw_input_hook(&self.ctx, &mut raw);
|
||||
}
|
||||
let app = &mut self.app;
|
||||
let mut out = self.ctx.run_ui(raw, |ui| {
|
||||
if let Some(id) = menu {
|
||||
@@ -88,6 +98,10 @@ fn press(key: Key, modifiers: Modifiers) -> Event {
|
||||
Event::Key { key, physical_key: None, pressed: true, repeat: false, modifiers }
|
||||
}
|
||||
|
||||
fn release(key: Key) -> Event {
|
||||
Event::Key { key, physical_key: None, pressed: false, repeat: false, modifiers: Modifiers::NONE }
|
||||
}
|
||||
|
||||
fn click(at: Pos2, pressed: bool) -> Event {
|
||||
Event::PointerButton { pos: at, button: PointerButton::Primary, pressed, modifiers: Modifiers::NONE }
|
||||
}
|
||||
@@ -260,6 +274,191 @@ fn the_clipboard_keys_in_a_focused_field_edit_its_text() {
|
||||
}
|
||||
}
|
||||
|
||||
/// The rectangle of the text `text` painted last in a frame's output.
|
||||
fn text_rect(out: &egui::FullOutput, text: &str) -> Rect {
|
||||
out.shapes
|
||||
.iter()
|
||||
.rev()
|
||||
.find_map(|s| match &s.shape {
|
||||
egui::Shape::Text(t) if t.galley.text() == text => Some(t.galley.rect.translate(t.pos.to_vec2())),
|
||||
_ => None,
|
||||
})
|
||||
.unwrap_or_else(|| panic!("no {text:?} painted"))
|
||||
}
|
||||
|
||||
/// Document Info open on its Objects category, after a few frames to lay it out: the last frame.
|
||||
fn show_document_info(a: &mut App) -> egui::FullOutput {
|
||||
a.app.run("window.panel", json!({"panel": "docInfo"})).unwrap();
|
||||
crate::panels::set_pstate(&a.ctx, "docinfo-category", "objects".to_string());
|
||||
let mut out = a.frame(vec![]);
|
||||
for _ in 0..3 {
|
||||
out = a.frame(vec![]);
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// Drag across the label text `text` painted in `out`, selecting it: the frame after the drag.
|
||||
fn select_label_text(a: &mut App, out: &egui::FullOutput, text: &str) -> egui::FullOutput {
|
||||
let r = text_rect(out, text);
|
||||
let (from, to) = (r.left_center() + vec2(1.0, 0.0), r.right_center() - vec2(1.0, 0.0));
|
||||
a.frame(vec![Event::PointerMoved(from)]);
|
||||
a.frame(vec![click(from, true)]);
|
||||
for k in 1..=4 {
|
||||
a.frame(vec![Event::PointerMoved(from + (to - from) * k as f32 / 4.0)]);
|
||||
}
|
||||
a.frame(vec![click(to, false)]);
|
||||
a.frame(vec![])
|
||||
}
|
||||
|
||||
/// Cmd+C or Cmd+X (`e`): the chord's frame, then the frame after it, when the keys are let go.
|
||||
fn clipboard_chord(a: &mut App, e: Event) -> (egui::FullOutput, egui::FullOutput) {
|
||||
let out = a.frame(vec![Event::ModifiersChanged(Modifiers::COMMAND), e]);
|
||||
(out, a.frame(vec![Event::ModifiersChanged(Modifiers::NONE)]))
|
||||
}
|
||||
|
||||
/// #8432: with a Document Info value's text selected, Copy and Cut (Cmd+C and Cmd+X, F3 and F2,
|
||||
/// or the menu bar's items) copy that text and leave the art. When the selected label is not
|
||||
/// drawn, Copy copies the art.
|
||||
#[test]
|
||||
fn copy_and_cut_copy_the_text_selected_in_a_panel_label() {
|
||||
let mut a = App::new();
|
||||
let out = show_document_info(&mut a);
|
||||
// The two rectangles' outlines: 2 × (20 + 20) + 2 × (37 + 40).
|
||||
let length = "234 pt";
|
||||
let select = |a: &mut App, out: &egui::FullOutput| select_label_text(a, out, length);
|
||||
let chord = clipboard_chord;
|
||||
let out = select(&mut a, &out);
|
||||
let (copy, after) = chord(&mut a, Event::Copy);
|
||||
assert_eq!(copied(©), [length], "Copy copies the selected value");
|
||||
assert!(copied(&after).is_empty(), "and nothing after it");
|
||||
assert!(a.app.session.clipboard.is_empty(), "no art copied");
|
||||
let (cut, after) = chord(&mut a, Event::Cut);
|
||||
assert_eq!(copied(&cut), [length], "Cut copies the selected value");
|
||||
assert!(copied(&after).is_empty(), "and nothing after it");
|
||||
assert_eq!(a.selected(), 1, "and leaves the art");
|
||||
assert!(a.app.session.clipboard.is_empty(), "no art cut");
|
||||
// Cut on a chord of the user's own that no other command has, which egui also sends as Cut: the
|
||||
// keymap does not cut the art after the label.
|
||||
let overrides = a.app.ui.shortcut_overrides.clone();
|
||||
crate::keymap::set_override(&mut a.app.ui.shortcut_overrides, "edit.cut", "Cmd+Alt+Shift+X");
|
||||
let cut = a.frame(vec![Event::ModifiersChanged(Modifiers::COMMAND | Modifiers::ALT | Modifiers::SHIFT), Event::Cut]);
|
||||
a.frame(vec![Event::ModifiersChanged(Modifiers::NONE)]);
|
||||
assert_eq!(copied(&cut), [length], "Cut on the user's chord copies the selected value");
|
||||
assert_eq!(a.selected(), 1, "and leaves the art");
|
||||
assert!(a.app.session.clipboard.is_empty(), "no art cut");
|
||||
// Copy and Cut on keys egui sends as key presses (F3 and F2, their keys off macOS).
|
||||
crate::keymap::set_override(&mut a.app.ui.shortcut_overrides, "edit.copy", "F3");
|
||||
crate::keymap::set_override(&mut a.app.ui.shortcut_overrides, "edit.cut", "F2");
|
||||
for (key, what) in [(Key::F3, "Copy"), (Key::F2, "Cut")] {
|
||||
let out = a.frame(vec![press(key, Modifiers::NONE)]);
|
||||
let after = a.frame(vec![release(key)]);
|
||||
assert_eq!(copied(&out), [length], "{what} on {key:?} copies the selected value");
|
||||
assert!(copied(&after).is_empty(), "and nothing after it");
|
||||
assert_eq!(a.selected(), 1, "{what} on {key:?} leaves the art");
|
||||
assert!(a.app.session.clipboard.is_empty(), "no art copied or cut");
|
||||
}
|
||||
// The menu bar's Edit › Copy and Edit › Cut (macOS).
|
||||
for (id, what) in [("edit.copy", "Copy"), ("edit.cut", "Cut")] {
|
||||
let menu = a.menu(id);
|
||||
let after = a.frame(vec![]);
|
||||
assert_eq!(copied(&menu), [length], "the menu's {what} copies the selected value");
|
||||
assert!(copied(&after).is_empty(), "and nothing after it");
|
||||
assert_eq!(a.selected(), 1, "the menu's {what} leaves the art");
|
||||
assert!(a.app.session.clipboard.is_empty(), "no art copied or cut");
|
||||
}
|
||||
a.app.ui.shortcut_overrides = overrides;
|
||||
// Tab hides the panels: the selected value is not drawn, so Copy copies the art, a frame later,
|
||||
// even when the window has lost the keyboard by then.
|
||||
select(&mut a, &out);
|
||||
a.app.ui.dock = false;
|
||||
let copy = a.frame(vec![Event::ModifiersChanged(Modifiers::COMMAND), Event::Copy]);
|
||||
a.focused = false;
|
||||
let after = a.frame(vec![Event::ModifiersChanged(Modifiers::NONE)]);
|
||||
a.focused = true;
|
||||
assert!(copied(©).is_empty(), "no label copied {length}");
|
||||
assert!(copied(&after).iter().any(|t| t.starts_with("<?xml")), "Copy copied the art");
|
||||
}
|
||||
|
||||
/// #8432: with a Document Info value's text selected, the keys another window sends on (through
|
||||
/// the host's raw input hook) copy that text only when they are a Copy of the main window's own or
|
||||
/// that window's labels copied it; Copy and F3 from a floating document's window copy the art.
|
||||
#[test]
|
||||
fn copy_sent_on_from_another_window_copies_the_text_only_when_it_is_this_windows() {
|
||||
let mut a = App::new();
|
||||
let out = show_document_info(&mut a);
|
||||
let length = "234 pt";
|
||||
select_label_text(&mut a, &out, length);
|
||||
crate::keymap::set_override(&mut a.app.ui.shortcut_overrides, "edit.copy", "F3");
|
||||
// The menu bar's Copy in a frame that also runs a Copy another window sent on.
|
||||
crate::panel_docking::forward_keys(&mut a.app, &a.ctx, vec![Event::Copy], Some(Modifiers::COMMAND));
|
||||
let menu = a.menu("edit.copy");
|
||||
a.frame(vec![]);
|
||||
assert_eq!(copied(&menu), [length], "the menu's Copy copies the selected value with a Copy sent on");
|
||||
assert!(a.app.session.clipboard.is_empty(), "no art copied");
|
||||
// Cmd+C in a frame that also runs other keys another window sent on (a key let go there).
|
||||
crate::panel_docking::forward_keys(&mut a.app, &a.ctx, vec![release(Key::A)], None);
|
||||
let copy = a.frame(vec![Event::ModifiersChanged(Modifiers::COMMAND), Event::Copy]);
|
||||
a.frame(vec![Event::ModifiersChanged(Modifiers::NONE)]);
|
||||
assert_eq!(copied(©), [length], "Cmd+C copies the selected value with other keys sent on");
|
||||
assert!(a.app.session.clipboard.is_empty(), "no art copied");
|
||||
// F3 in a frame that also runs another key pressed in another window.
|
||||
crate::panel_docking::forward_keys(&mut a.app, &a.ctx, vec![press(Key::F13, Modifiers::NONE), release(Key::F13)], None);
|
||||
let copy = a.frame(vec![press(Key::F3, Modifiers::NONE)]);
|
||||
a.frame(vec![release(Key::F3)]);
|
||||
assert_eq!(copied(©), [length], "F3 copies the selected value with another key sent on");
|
||||
assert!(a.app.session.clipboard.is_empty(), "no art copied");
|
||||
// A Copy another window sends on: a floating panel's window whose label copied its text copies
|
||||
// nothing more. From any other window (a floating document's), the art is copied, not the text
|
||||
// still selected in this window's panel.
|
||||
let forward = |a: &mut App, keys: Vec<Event>, modifiers: Modifiers| {
|
||||
crate::panel_docking::forward_keys(&mut a.app, &a.ctx, keys, Some(modifiers));
|
||||
(a.frame(vec![]), a.frame(vec![]))
|
||||
};
|
||||
crate::shortcuts::note_copied_in_window(&a.ctx);
|
||||
let (copy, after) = forward(&mut a, vec![Event::Copy], Modifiers::COMMAND);
|
||||
assert!(copied(©).is_empty() && copied(&after).is_empty(), "the window copied its own text");
|
||||
assert!(a.app.session.clipboard.is_empty(), "no art copied");
|
||||
let (copy, _) = forward(&mut a, vec![Event::Copy], Modifiers::COMMAND);
|
||||
assert!(copied(©).iter().all(|t| t != length), "{length} was copied from the other window");
|
||||
assert!(!a.app.session.clipboard.is_empty(), "Copy from the other window copied the art");
|
||||
// F3 sent on from another window copies the art too.
|
||||
let (copy, after) = forward(&mut a, vec![press(Key::F3, Modifiers::NONE), release(Key::F3)], Modifiers::NONE);
|
||||
assert!(copied(©).iter().chain(&copied(&after)).all(|t| t != length), "{length} was copied by F3 from the other window");
|
||||
assert!(copied(©).iter().chain(&copied(&after)).any(|t| t.starts_with("<?xml")), "F3 from the other window copied the art");
|
||||
}
|
||||
|
||||
/// #8432: Copy or Cut with a Document Info value's text selected, by its keys or the menu bar's
|
||||
/// item, drops the formats an earlier Copy of the art has not written to the system clipboard yet,
|
||||
/// so they do not replace the copied value.
|
||||
#[test]
|
||||
fn panel_text_copied_before_the_art_formats_are_written_stays_on_the_clipboard() {
|
||||
// `menu`: the menu bar's item (macOS) while the window does not have the keyboard, else the
|
||||
// keys (Cmd+C, Cmd+X).
|
||||
for (menu, cut) in [(false, false), (false, true), (true, false), (true, true)] {
|
||||
let (id, event) = if cut { ("edit.cut", Event::Cut) } else { ("edit.copy", Event::Copy) };
|
||||
let (app, board, hold) = super::sysclip::app_with_busy_worker("");
|
||||
let mut a = App { app, ctx: egui::Context::default(), time: 0.0, focused: true };
|
||||
super::sysclip::copy_rect(&mut a.app);
|
||||
let out = show_document_info(&mut a);
|
||||
// The rectangle's outline: 2 × (40 + 20).
|
||||
let length = "120 pt";
|
||||
select_label_text(&mut a, &out, length);
|
||||
let copy = if menu {
|
||||
a.focused = false;
|
||||
let copy = a.menu(id);
|
||||
a.focused = true;
|
||||
copy
|
||||
} else {
|
||||
clipboard_chord(&mut a, event).0
|
||||
};
|
||||
assert_eq!(copied(©), [length], "{id} copies the selected value (menu: {menu})");
|
||||
assert_eq!(a.selected(), 1, "{id} leaves the art (menu: {menu})");
|
||||
drop(hold);
|
||||
crate::background::wait_all(&mut a.app);
|
||||
assert_eq!(super::sysclip::writes(&board), 0, "the art's formats were not written over it ({id}, menu: {menu})");
|
||||
}
|
||||
}
|
||||
|
||||
/// The centre of the text `label` painted last (in the topmost layer) in a frame's output; with
|
||||
/// `title`, the first one painted (the menu bar's).
|
||||
fn text_at(out: &egui::FullOutput, label: &str, title: bool) -> Pos2 {
|
||||
|
||||
@@ -164,6 +164,11 @@ pub(super) fn copy_rect(app: &mut VectorcraftApp) {
|
||||
run(app, "edit.copy", json!({}));
|
||||
}
|
||||
|
||||
/// How many times the app wrote the clipboard.
|
||||
pub(super) fn writes(board: &Rc<RefCell<Board>>) -> usize {
|
||||
board.borrow().writes
|
||||
}
|
||||
|
||||
pub(super) fn written(board: &Rc<RefCell<Board>>) -> Vec<&'static str> {
|
||||
board.borrow().flavours.iter().map(|f| f.mime).collect()
|
||||
}
|
||||
@@ -579,6 +584,21 @@ fn text_copied_before_the_formats_are_written_stays_on_the_clipboard() {
|
||||
assert_eq!(t.plain_text(), "Words copied in a field");
|
||||
}
|
||||
|
||||
/// Text a floating panel's label copies after Copy, before the formats are written: its window
|
||||
/// keeps the Copy, the formats are not written, and the system clipboard keeps the text.
|
||||
#[test]
|
||||
fn label_text_copied_before_the_formats_are_written_stays_on_the_clipboard() {
|
||||
let (mut app, board, hold) = app_with_busy_worker("");
|
||||
copy_rect(&mut app);
|
||||
let ctx = egui::Context::default();
|
||||
crate::shortcuts::note_copied_in_window(&ctx);
|
||||
crate::panel_docking::forward_keys(&mut app, &ctx, vec![egui::Event::Copy], Some(egui::Modifiers::COMMAND));
|
||||
assert!(app.forwarded.is_empty(), "the window's Copy stays there");
|
||||
drop(hold);
|
||||
background::wait_all(&mut app);
|
||||
assert_eq!(board.borrow().writes, 0);
|
||||
}
|
||||
|
||||
/// The Edit menu's Paste into a text field after Copy of type, before the formats are written: it
|
||||
/// waits for them, not for a save started after them, and pastes the type's text, not what
|
||||
/// another app copied before.
|
||||
|
||||
@@ -1220,6 +1220,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
- On Windows and Linux, F2, F3 and F4 run Cut, Copy and Paste alongside Ctrl+X, Ctrl+C and Ctrl+V, and in the web build they do so everywhere except macOS. The Edit menu keeps the Ctrl shortcuts, and Keyboard Shortcuts lists both keys of each row. On macOS only Cmd+X, Cmd+C and Cmd+V are the defaults. F2, F3 and F4 do not run these commands in a focused text field or while the Type tool edits text. A saved shortcut set that assigns one of these keys to another command keeps that assignment. Public reference: [Default keyboard shortcuts](https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html).
|
||||
- Cmd/Ctrl+A follows the keyboard: in a panel, dialog or search field it selects the field's text, while the Type tool edits it selects all of that text (also `select.all` over MCP), and only otherwise every object. On macOS the menu bar's Select All, Cut, Copy and Paste (keys or clicks) act on a focused field too, and elsewhere the in-window menus' do: the field that had the keyboard when the menu opened gets them, with its selection, and the keyboard back (#516). Not yet: Select All across threaded frames (one frame's text is selected).
|
||||
- Cmd/Ctrl+A follows the keyboard: in a panel, dialog or search field it selects the field's text, while the Type tool edits it selects all of that text (also `select.all` over MCP), and only otherwise every object. On macOS the menu bar's Select All, Cut, Copy and Paste (keys or clicks) act on a focused field too, and elsewhere the in-window menus' do: the field that had the keyboard when the menu opened gets them, with its selection, and the keyboard back (#516). In a frame of threaded text, Select All selects the whole story, highlighted in every frame: Copy and Cut take all of it, typing or Delete replaces it as one undo step, and a fill, a size step or a Character or Paragraph panel change applies to every frame's text (VectorCraft's own behavior; `textedit::select_all_in_a_threaded_frame_selects_the_whole_story`, `textedit::typing_over_the_whole_story_replaces_every_frames_text_in_one_step`).
|
||||
- With text selected in a panel's label, such as a Document Info value, Cmd/Ctrl+C and Cmd/Ctrl+X copy that text and do not copy or cut the art, and so do F3 and F2 where they are Copy and Cut, any other keys assigned to Copy or Cut, and the menu bar's Copy and Cut on macOS. When the selected label is not drawn (the panels are hidden), Copy and Cut act on the art instead (#8432; VectorCraft's own behavior; `selectall::copy_and_cut_copy_the_text_selected_in_a_panel_label`, `selectall::copy_sent_on_from_another_window_copies_the_text_only_when_it_is_this_windows`, `selectall::panel_text_copied_before_the_art_formats_are_written_stays_on_the_clipboard`, `shortcuts::tests::a_window_notes_only_its_labels_copies_until_the_next_main_window_pass`, `shortcuts::tests::a_window_notes_a_copy_of_text_dragged_across_its_label`). Not yet: the in-window Edit menu's Copy and Cut (the click on the menu clears the label's selection first), and, while the selected text is in a floating panel's own window, the menu bar's Copy and Cut, and F3 and F2 (they do not copy the text).
|
||||
- With the whole story of threaded text selected by Select All, Remove Line Breaks, Remove Paragraph Breaks and Type › Bullets and Numbering › Convert to Text act on the text of every frame as one undo step, locked and hidden frames included, and the story stays selected after Convert to Text; a selection inside one frame changes only that frame (VectorCraft's own behavior; `textedit::remove_breaks_takes_the_whole_story_that_select_all_selected`, `textedit::convert_to_text_takes_the_whole_story_that_select_all_selected`, `textedit::convert_to_text_of_the_whole_story_converts_locked_and_hidden_frames`, `textedit::remove_breaks_of_the_whole_story_takes_locked_and_hidden_frames`).
|
||||
- When only some frames of a threaded story are selected, Remove Line Breaks and Remove Paragraph Breaks go through that story's frames once for all of them, not once per selected frame; each selected frame still loses its own breaks, in the order selected, as one undo step (`addons::cleanup::text::tests::remove_breaks_goes_through_a_partly_named_story_once`).
|
||||
- With the whole story of threaded text selected by Select All, the Character, Paragraph, OpenType, Tabs and Text Styles panels, the Justification dialog and the font menu change the frames that are in the edited frame's thread at the time of the change, locked and hidden frames included. A frame that has left the thread is not changed, and a frame added to the thread is (VectorCraft's own behavior; `panels::character::tests::story_changes_follow_the_edited_frames_thread_after_the_first_saved_frame_leaves`, `story_changes_leave_out_a_frame_that_left_and_take_in_a_frame_that_joined`, `story_changes_stay_in_the_edited_frame_once_its_thread_is_removed`, `story_changes_take_in_locked_and_hidden_frames`, `panels::tabs::tests::indent_markers_after_select_all_keep_each_story_paragraphs_indents`, `dialogs::justification::tests::justification_dialog_follows_the_story_thread_at_ok`).
|
||||
|
||||
Reference in new issue
Block a user