termui: add show_cursor() and hide_cursor() (#9087)

This commit is contained in:
James Addison 2021-03-04 10:31:26 +00:00 committed by GitHub
parent 9bb073580e
commit a64d9b3e12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 2 deletions

View file

@ -58,6 +58,18 @@ pub fn (mut ctx Context) set_cursor_position(x int, y int) {
ctx.write('\x1b[$y;${x}H')
}
[inline]
// show_cursor will make the cursor appear if it is not already visible
pub fn (mut ctx Context) show_cursor() {
ctx.write('\x1b[?25h')
}
// hide_cursor will make the cursor invisible
[inline]
pub fn (mut ctx Context) hide_cursor() {
ctx.write('\x1b[?25l')
}
[inline]
// set_color sets the current foreground color used by any succeeding `draw_*` calls.
pub fn (mut ctx Context) set_color(c Color) {