diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-12-09 16:51:15 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-12-09 16:51:15 -0500 |
commit | c02cd7278b23ed0423f8c798a939aff05b69039c (patch) | |
tree | bd55efc8300de8068cf4f115bad63f4e1c6ec7e1 | |
parent | d3250dbffd9bc64efc5592a8e12578b740a84257 (diff) | |
download | textmode-c02cd7278b23ed0423f8c798a939aff05b69039c.tar.gz textmode-c02cd7278b23ed0423f8c798a939aff05b69039c.zip |
add function to hide or show the cursor
-rw-r--r-- | CHANGELOG.md | 6 | ||||
-rw-r--r-- | src/lib.rs | 9 |
2 files changed, 15 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 02f953f..61a02ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [Unreleased] + +### Added + +* `hide_cursor` to hide or show the cursor + ## [0.2.2] - 2021-12-06 ### Changed @@ -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"); + } + } } |