aboutsummaryrefslogtreecommitdiff
path: root/src/ghostty/mod.rs
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-04-07 02:48:13 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-04-07 02:48:13 +0300
commit5e05460816bbcea61a111bfa57be9907116e8ffc (patch)
tree86309a79cd7f49b82e0129de131c6723365a14a1 /src/ghostty/mod.rs
parent06f01df93d895298508173cd59a8cf8eb2dd5bdc (diff)
docs: clarify herdr pane split and wait output usage
Diffstat (limited to 'src/ghostty/mod.rs')
-rw-r--r--src/ghostty/mod.rs29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/ghostty/mod.rs b/src/ghostty/mod.rs
index 297b0e6b..55bafebc 100644
--- a/src/ghostty/mod.rs
+++ b/src/ghostty/mod.rs
@@ -461,11 +461,27 @@ impl Terminal {
end: (u16, u32),
rectangle: bool,
) -> Result<String, Error> {
- let selection = GhosttyTerminalSelection {
+ self.read_text_selection(GhosttyTerminalSelection {
start: ghostty_viewport_point(start.0, start.1),
end: ghostty_viewport_point(end.0, end.1),
rectangle,
- };
+ })
+ }
+
+ pub fn read_text_screen(
+ &self,
+ start: (u16, u32),
+ end: (u16, u32),
+ rectangle: bool,
+ ) -> Result<String, Error> {
+ self.read_text_selection(GhosttyTerminalSelection {
+ start: ghostty_screen_point(start.0, start.1),
+ end: ghostty_screen_point(end.0, end.1),
+ rectangle,
+ })
+ }
+
+ fn read_text_selection(&self, selection: GhosttyTerminalSelection) -> Result<String, Error> {
let mut out_ptr = ptr::null_mut();
let mut out_len = 0usize;
unsafe {
@@ -570,6 +586,15 @@ fn ghostty_viewport_point(x: u16, y: u32) -> ffi::GhosttyPoint {
}
}
+fn ghostty_screen_point(x: u16, y: u32) -> ffi::GhosttyPoint {
+ ffi::GhosttyPoint {
+ tag: ffi::GhosttyPointTag_GHOSTTY_POINT_TAG_SCREEN,
+ value: ffi::GhosttyPointValue {
+ coordinate: ffi::GhosttyPointCoordinate { x, y },
+ },
+ }
+}
+
pub struct RenderState {
raw: ffi::GhosttyRenderState_ptr,
}