diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-22 14:30:16 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-22 14:30:16 +0300 |
| commit | 4846cb1324a6a9e46bc89250cf8a289b91866a9c (patch) | |
| tree | a083847aa50941799a31493266770ce58f3f4b19 /src/ghostty | |
| parent | b76fb4950c30e9bb7836bcd54792066d077a1911 (diff) | |
fix: skip wide spacer cells in pane reads
refs #698
Diffstat (limited to 'src/ghostty')
| -rw-r--r-- | src/ghostty/mod.rs | 24 |
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, |
