From de9ad07b2a4737713f1473641fe195d7e3023928 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Fri, 2 Aug 2024 18:09:23 +0200 Subject: add tui-cursor handling --- src/tuicursor.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/tuicursor.rs (limited to 'src/tuicursor.rs') diff --git a/src/tuicursor.rs b/src/tuicursor.rs new file mode 100644 index 0000000..fbb7531 --- /dev/null +++ b/src/tuicursor.rs @@ -0,0 +1,15 @@ +use ratatui::{crossterm::cursor::SetCursorStyle, layout::Rect}; + +pub struct TuiCursor { + pub position: (u16, u16), + pub style: SetCursorStyle, +} + +impl TuiCursor { + pub fn relative_to(self, rect: Rect) -> Self { + Self { + position: (rect.y + self.position.0, rect.x + self.position.1), + style: self.style, + } + } +} -- cgit v1.2.3-70-g09d2