aboutsummaryrefslogtreecommitdiff
path: root/src/ghostty
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-05-15 20:53:34 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-05-15 20:53:55 +0300
commit73dba97521f5a0e3104518ef48b775a178998f52 (patch)
treead9f95b4836303a35974b9ccdde229a1b05b03f4 /src/ghostty
parent4cbe72ec2d8a174e3c4f9bde2101aa189c7f38e7 (diff)
fix: forward pane cursor shape
fixes #116
Diffstat (limited to 'src/ghostty')
-rw-r--r--src/ghostty/mod.rs43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/ghostty/mod.rs b/src/ghostty/mod.rs
index a0ff3226..ef03716a 100644
--- a/src/ghostty/mod.rs
+++ b/src/ghostty/mod.rs
@@ -204,6 +204,31 @@ pub struct KittyPlacementRenderInfo {
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub enum CursorVisualStyle {
+ Bar,
+ Block,
+ Underline,
+ BlockHollow,
+}
+
+impl CursorVisualStyle {
+ fn from_raw(value: ffi::GhosttyRenderStateCursorVisualStyle) -> Self {
+ match value {
+ ffi::GhosttyRenderStateCursorVisualStyle_GHOSTTY_RENDER_STATE_CURSOR_VISUAL_STYLE_BLOCK => {
+ Self::Block
+ }
+ ffi::GhosttyRenderStateCursorVisualStyle_GHOSTTY_RENDER_STATE_CURSOR_VISUAL_STYLE_UNDERLINE => {
+ Self::Underline
+ }
+ ffi::GhosttyRenderStateCursorVisualStyle_GHOSTTY_RENDER_STATE_CURSOR_VISUAL_STYLE_BLOCK_HOLLOW => {
+ Self::BlockHollow
+ }
+ _ => Self::Bar,
+ }
+ }
+}
+
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ActiveScreen {
Primary,
Alternate,
@@ -1278,6 +1303,24 @@ impl RenderState {
self.get_bool(ffi::GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_CURSOR_VISIBLE)
}
+ pub fn cursor_blinking(&self) -> Result<bool, Error> {
+ self.get_bool(ffi::GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_CURSOR_BLINKING)
+ }
+
+ pub fn cursor_visual_style(&self) -> Result<CursorVisualStyle, Error> {
+ let mut out: ffi::GhosttyRenderStateCursorVisualStyle = 0;
+ // SAFETY: out points to the matching enum storage for the requested data kind.
+ unsafe {
+ ffi::ghostty_render_state_get(
+ self.raw,
+ ffi::GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_CURSOR_VISUAL_STYLE,
+ (&mut out as *mut ffi::GhosttyRenderStateCursorVisualStyle).cast(),
+ )
+ .into_result()?;
+ }
+ Ok(CursorVisualStyle::from_raw(out))
+ }
+
pub fn cursor_viewport(&self) -> Result<Option<CursorViewport>, Error> {
if !self.get_bool(
ffi::GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_CURSOR_VIEWPORT_HAS_VALUE,