aboutsummaryrefslogtreecommitdiff
path: root/src/ghostty
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-06-22 14:30:16 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-06-22 14:30:16 +0300
commit4846cb1324a6a9e46bc89250cf8a289b91866a9c (patch)
treea083847aa50941799a31493266770ce58f3f4b19 /src/ghostty
parentb76fb4950c30e9bb7836bcd54792066d077a1911 (diff)
fix: skip wide spacer cells in pane reads
refs #698
Diffstat (limited to 'src/ghostty')
-rw-r--r--src/ghostty/mod.rs24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/ghostty/mod.rs b/src/ghostty/mod.rs
index 17f9af32..2b45e3d8 100644
--- a/src/ghostty/mod.rs
+++ b/src/ghostty/mod.rs
@@ -742,9 +742,11 @@ impl Terminal {
})
}
- pub fn screen_graphemes(&self, x: u16, y: u32) -> Result<Vec<u32>, Error> {
+ pub fn screen_cell(&self, x: u16, y: u32) -> Result<(CellWide, Vec<u32>), Error> {
let grid_ref = self.grid_ref(ghostty_screen_point(x, y))?;
- grid_ref_graphemes(&grid_ref)
+ let wide = grid_ref_wide(&grid_ref)?;
+ let graphemes = grid_ref_graphemes(&grid_ref)?;
+ Ok((wide, graphemes))
}
fn viewport_graphemes_and_style(&self, x: u16, y: u32) -> Result<(Vec<u32>, CellStyle), Error> {
@@ -1393,6 +1395,24 @@ fn grid_ref_graphemes(grid_ref: &ffi::GhosttyGridRef) -> Result<Vec<u32>, Error>
Ok(buffer)
}
+fn grid_ref_wide(grid_ref: &ffi::GhosttyGridRef) -> Result<CellWide, Error> {
+ let mut raw = ffi::GhosttyCell::default();
+ unsafe {
+ ffi::ghostty_grid_ref_cell(grid_ref, &mut raw).into_result()?;
+ }
+
+ let mut wide = ffi::GhosttyCellWide_GHOSTTY_CELL_WIDE_NARROW;
+ unsafe {
+ ffi::ghostty_cell_get(
+ raw,
+ ffi::GhosttyCellData_GHOSTTY_CELL_DATA_WIDE,
+ (&mut wide as *mut ffi::GhosttyCellWide).cast(),
+ )
+ .into_result()?;
+ }
+ Ok(CellWide::from_raw(wide))
+}
+
fn kitty_placement_u32(
iterator: ffi::GhosttyKittyGraphicsPlacementIterator,
data: ffi::GhosttyKittyGraphicsPlacementData,