mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
termui: add show_cursor() and hide_cursor() (#9087)
This commit is contained in:
parent
9bb073580e
commit
a64d9b3e12
@ -68,7 +68,8 @@ pub fn init(cfg Config) &Context {
|
||||
}
|
||||
|
||||
if ctx.cfg.hide_cursor {
|
||||
print('\x1b[?25l')
|
||||
ctx.hide_cursor()
|
||||
ctx.flush()
|
||||
}
|
||||
|
||||
if ctx.cfg.window_title != '' {
|
||||
|
@ -77,7 +77,8 @@ fn (mut ctx Context) termios_setup() ? {
|
||||
}
|
||||
|
||||
if ctx.cfg.hide_cursor {
|
||||
print('\x1b[?25l')
|
||||
ctx.hide_cursor()
|
||||
ctx.flush()
|
||||
}
|
||||
|
||||
if ctx.cfg.window_title != '' {
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user