1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

term: add get_cursor_position and set_terminal_title (#6279)

* added functions

added:
  - get_cursor_position()
  - set_terminal_title(title string)

* implement term.get_cursor_position and term.set_terminal_title on unix

* Cleanup

* make x,y fields of term.Coord mutable

* fix vrepl compilation

* use more descriptive var names in term_test.v

* do not change the current terminal title in dumb terminals; do not test term.set_terminal_title outside of CI

* unix: in term.set_terminal_title, return true even for dumb terminals

Co-authored-by: Brent Pryer <brent@pryermachine.com>
Co-authored-by: Delyan Angelov <delian66@gmail.com>
This commit is contained in:
bpryer
2020-09-08 14:00:10 -05:00
committed by GitHub
parent 49c322f120
commit 3f7970db52
8 changed files with 163 additions and 18 deletions

View File

@@ -6,6 +6,14 @@ const (
default_columns_size = 80
default_rows_size = 25
)
// Coord - used by term.get_cursor_position and term.set_cursor_position
pub struct Coord {
pub mut:
x int
y int
}
// can_show_color_on_stdout returns true if colors are allowed in stdout;
// returns false otherwise.
pub fn can_show_color_on_stdout() bool {