diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-08-02 18:09:23 +0200 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-08-02 18:09:23 +0200 |
| commit | de9ad07b2a4737713f1473641fe195d7e3023928 (patch) | |
| tree | 38f3bdb122b6e94fe45dbfa2264314c7a7f26be8 /src/tuicursor.rs | |
| parent | 29ab8b40dc6976687ffb8bfbf663314b0ec3c46e (diff) | |
add tui-cursor handling
Diffstat (limited to 'src/tuicursor.rs')
| -rw-r--r-- | src/tuicursor.rs | 15 |
1 files changed, 15 insertions, 0 deletions
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, + } + } +} |