mirror of
https://github.com/storytold/deckcraft.git
synced 2026-12-01 18:23:52 -06:00
Merge branch 'port/deckcraft/red/app-r5-2' into port/deckcraft/area/app
This commit is contained in:
@@ -6,7 +6,7 @@ use super::state::{FilePlace, FilePurpose, LocatedPlace, RECENT_MAX, ViewMode};
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use super::updates_ui;
|
||||
use super::{
|
||||
AnimPreview, FileTarget, HashMap, InputTarget, Mods, PendingFile, Perf, Platform, Session, SlideApp, Target, UiRequest, Value, backstage,
|
||||
AnimPreview, FileTarget, HashMap, InputTarget, PendingFile, Perf, Platform, Session, SlideApp, Target, UiRequest, Value, backstage,
|
||||
dialogs, doc_window, json, media, menus, preview, qat, ribbon, show, sorter, status, toast,
|
||||
};
|
||||
use craft::ui::contract::{Bind, CommandSet as _, Tracked};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use super::{Mods, SlideApp};
|
||||
use super::SlideApp;
|
||||
use craft::keymap::{Chord, Key, Mods as KeyMods};
|
||||
use craft::ui::runtime::focus;
|
||||
use craft::ui::runtime::keys::{Intent, with_window_intents};
|
||||
@@ -41,21 +41,13 @@ impl SlideApp {
|
||||
break;
|
||||
}
|
||||
match event {
|
||||
egui::Event::Key { key, pressed: true, modifiers, .. } => {
|
||||
let mods =
|
||||
Mods { shift: modifiers.shift, alt: modifiers.alt, cmd: modifiers.command || (!self.session.mac_keys && modifiers.ctrl) };
|
||||
if key == egui::Key::Tab && !focus::has_any(ctx) {
|
||||
// The slide has the keyboard, so Tab is ours (indent, tab character, next
|
||||
// shape). Left to egui it would also focus the first ribbon widget, and
|
||||
// every key after it would go there instead of the slide (#78).
|
||||
ctx.memory_mut(|m| m.move_focus(egui::FocusDirection::None));
|
||||
}
|
||||
if focus::has_any(ctx) {
|
||||
continue;
|
||||
}
|
||||
if let Err(error) = self.session.key(key_name(key), mods) {
|
||||
self.set_status(error.to_string());
|
||||
}
|
||||
// Bound chords fire through the command catalogue and the canvas tool's key claims
|
||||
// run the slide's own keys, so a key event here only keeps Tab on the slide.
|
||||
egui::Event::Key { key: egui::Key::Tab, pressed: true, .. } if !focus::has_any(ctx) => {
|
||||
// The slide has the keyboard, so Tab is ours (indent, tab character, next
|
||||
// shape). Left to egui it would also focus the first ribbon widget, and
|
||||
// every key after it would go there instead of the slide (#78).
|
||||
ctx.memory_mut(|m| m.move_focus(egui::FocusDirection::None));
|
||||
}
|
||||
// egui 0.37 carries a clipboard image as its own event; it inserts once.
|
||||
egui::Event::PasteImage(image) if !focus::has_any(ctx) => {
|
||||
|
||||
@@ -830,15 +830,18 @@ fn missing_recent_is_marked_and_its_error_shows() {
|
||||
/// The existence probe tells present files from missing ones and never touches remote paths.
|
||||
#[test]
|
||||
fn recent_exists_tells_missing_from_present() {
|
||||
let mut harness = crate::test_harness::harness(Session::new(), Services::default());
|
||||
let path = std::path::PathBuf::from("/deckcraft-tests/172/present.deckcraft");
|
||||
let files = std::sync::Arc::new(craft::host::ScriptedFiles::new().with_file(&path, Vec::new()));
|
||||
let mut harness = crate::test_harness::harness_with(
|
||||
Session::new(),
|
||||
Services::default(),
|
||||
egui_kittest::Harness::builder().with_size(egui::vec2(1440.0, 900.0)),
|
||||
|platform| platform.host = platform.host.with_files(files),
|
||||
);
|
||||
let app = harness.state_mut();
|
||||
let mut path = std::env::temp_dir();
|
||||
path.push(format!("deckcraft-test-172-{}.deckcraft", std::process::id()));
|
||||
std::fs::write(&path, b"").unwrap();
|
||||
assert!(app.recent_exists(&path.to_string_lossy()), "the file exists");
|
||||
assert!(!app.recent_exists("/deckcraft-tests/172/missing.deckcraft"));
|
||||
assert!(app.recent_exists("\\\\server/share/deck.deckcraft"), "UNC paths are never probed");
|
||||
std::fs::remove_file(&path).ok();
|
||||
}
|
||||
|
||||
/// #339: clicking a language in Review > Language did nothing, and OK didn't mark the text.
|
||||
|
||||
Reference in New Issue
Block a user