T22: Edit's Copy, Paste and Select All are Ely's text input actions, which Ely a2cb531 exports and the terminal handles too, so the menu reaches find and every field; Select All counts a space under a combining mark as a character; comments cut to one short line; the Ely pin moves to a2cb531; AGENTS.md says gpui draws a shot window only while macOS shows it
This commit is contained in:
11 files changed
+56
-39
No files matched your search
@@ -17,7 +17,7 @@ pub fn number(window: &gpui::Window) -> anyhow::Result<u32> {
|
||||
u32::try_from(number).context("window number out of range")
|
||||
}
|
||||
|
||||
/// Shows the window and makes it the app's key window, which AppKit sends keys to, without activating the app: gpui draws it, real input stays put.
|
||||
/// Shows the window as key, the app left inactive.
|
||||
pub fn front(number: u32) -> anyhow::Result<()> {
|
||||
unsafe {
|
||||
let app: *mut Object = msg_send![class!(NSApplication), sharedApplication];
|
||||
@@ -29,7 +29,7 @@ pub fn front(number: u32) -> anyhow::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// The class of each view under the window's content, as AppKit names it; gpui's blur is a `BlurredView`.
|
||||
/// AppKit's class of each view under the content.
|
||||
pub fn views(number: u32) -> anyhow::Result<Vec<String>> {
|
||||
unsafe {
|
||||
let app: *mut Object = msg_send![class!(NSApplication), sharedApplication];
|
||||
@@ -50,7 +50,7 @@ pub fn views(number: u32) -> anyhow::Result<Vec<String>> {
|
||||
}
|
||||
}
|
||||
|
||||
/// The menu bar's items as AppKit holds them: menu, item, then the key and its modifier mask.
|
||||
/// Each menu item with its key and modifier mask.
|
||||
pub fn menus() -> Vec<String> {
|
||||
let text = |string: *mut Object| -> String {
|
||||
let bytes: *const std::ffi::c_char = unsafe { msg_send![string, UTF8String] };
|
||||
@@ -80,7 +80,7 @@ pub fn menus() -> Vec<String> {
|
||||
lines
|
||||
}
|
||||
|
||||
/// Writes the window `number` as a PNG; the app's own window needs no permission.
|
||||
/// Writes window `number` as a PNG.
|
||||
pub fn snapshot(number: u32, path: &Path) -> anyhow::Result<()> {
|
||||
use core_graphics::{
|
||||
geometry::{CGPoint, CGRect, CGSize},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! Runs a program in the main window, plays keys and mouse gestures on it, photographs it and names its AppKit views; `to:settings` and `to:main` aim what follows.
|
||||
//! Plays SPECS on the app's windows and photographs one.
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
fn main() {
|
||||
|
||||
@@ -59,7 +59,7 @@ fn string(text: &str) -> *mut Object {
|
||||
unsafe { msg_send![class!(NSString), stringWithUTF8String: text.as_ptr()] }
|
||||
}
|
||||
|
||||
/// `mark` composes `text` as an input method does; `commit` types it.
|
||||
/// An input method's `mark` or `commit` of `text`.
|
||||
fn compose(call: &str, text: &str, number: u32) -> anyhow::Result<()> {
|
||||
let none = Range {
|
||||
location: i64::MAX as u64,
|
||||
@@ -114,7 +114,7 @@ fn steps(gesture: &str, points: &[CGPoint]) -> anyhow::Result<Vec<(String, CGPoi
|
||||
})
|
||||
}
|
||||
|
||||
/// A step's event type, button and the selector gpui's view takes it by.
|
||||
/// A step's event type, button and gpui's selector.
|
||||
fn kind(step: &str) -> anyhow::Result<(CGEventType, CGMouseButton, &'static str)> {
|
||||
Ok(match step {
|
||||
"ldown" => (
|
||||
@@ -153,7 +153,7 @@ fn kind(step: &str) -> anyhow::Result<(CGEventType, CGMouseButton, &'static str)
|
||||
})
|
||||
}
|
||||
|
||||
/// Hands gpui's view a mouse gesture as AppKit events, even while the window is inactive.
|
||||
/// Hands gpui's view a gesture as AppKit events.
|
||||
fn mouse(name: &str, flags: u64, number: u32) -> anyhow::Result<()> {
|
||||
let mut fields = name.split('@');
|
||||
let gesture = fields.next().context("a gesture")?;
|
||||
@@ -214,7 +214,7 @@ fn mouse(name: &str, flags: u64, number: u32) -> anyhow::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Posts `spec`, a key, an input method call or a mouse gesture, on window `number`.
|
||||
/// Posts one spec on window `number`.
|
||||
pub fn post(spec: &str, number: u32) -> anyhow::Result<()> {
|
||||
if let Some((call, text)) = spec.split_once(':') {
|
||||
return compose(call, text, number);
|
||||
|
||||
Reference in new issue
Block a user