T66: files dropped on the terminal type their paths, which a user asked for after 0.1.6, as macOS Terminal does: each escaped for the shell, or quoted on Windows when it holds a space, followed by a space, sent as a paste; a path not in UTF-8 or holding a control character stops the drop; the font code moves from view.rs to fonts.rs, which view.rs needed room for; shot plays a drop with drop@x,y
This commit is contained in:
10 files changed
+227
-76
No files matched your search
@@ -314,3 +314,20 @@ fn key(spec: &str, number: u32, kinds: &[u64]) -> anyhow::Result<()> {
|
||||
log::info!("shot: typed {spec}, the app {state}");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// A file drop of `paths`, one a line, at `at`, `x,y` from the content's top-left, as gpui's AppKit view sends it.
|
||||
pub fn drop(at: &str, paths: &str) -> anyhow::Result<[gpui::PlatformInput; 4]> {
|
||||
use gpui::{ExternalPaths, FileDropEvent, PlatformInput, point, px};
|
||||
let (x, y) = at
|
||||
.split_once(',')
|
||||
.with_context(|| format!("a point in {at}"))?;
|
||||
let position = point(px(x.parse()?), px(y.parse()?));
|
||||
let paths = ExternalPaths(paths.lines().map(Into::into).collect());
|
||||
Ok([
|
||||
FileDropEvent::Entered { position, paths },
|
||||
FileDropEvent::Pending { position },
|
||||
FileDropEvent::Submit { position },
|
||||
FileDropEvent::Ended,
|
||||
]
|
||||
.map(PlatformInput::FileDrop))
|
||||
}
|
||||
Reference in new issue
Block a user