From c02cd7278b23ed0423f8c798a939aff05b69039c Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 9 Dec 2021 16:51:15 -0500 Subject: add function to hide or show the cursor --- src/lib.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index 67c0676..6c515c6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -265,4 +265,13 @@ pub trait Textmode: private::Output { self.write(b"\x1b[27m"); } } + + /// Sets whether the cursor should be visible. + fn hide_cursor(&mut self, hide: bool) { + if hide { + self.write(b"\x1b[?25l"); + } else { + self.write(b"\x1b[?25h"); + } + } } -- cgit v1.2.3-54-g00ecf