mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
test: use 'stty size' for vtest --- line instead of 'tput cols'
This commit is contained in:

committed by
Alexander Medvednikov

parent
6c4ef368d7
commit
cf37028a52
@@ -27,3 +27,17 @@ pub fn fail_message(s string) string {
|
||||
return if can_show_color_on_stdout() { red(s) } else { s }
|
||||
}
|
||||
|
||||
// h_divider will return a horizontal divider line with a dynamic width,
|
||||
// that depends on the current terminal settings
|
||||
pub fn h_divider() string {
|
||||
mut cols := 76
|
||||
if term_size := os.exec('stty size') {
|
||||
if term_size.exit_code == 0 {
|
||||
term_cols := term_size.output.split(' ')[1].int()
|
||||
if term_cols > 0 {
|
||||
cols = term_cols
|
||||
}
|
||||
}
|
||||
}
|
||||
return '-'.repeat(cols)
|
||||
}
|
||||
|
@@ -95,4 +95,3 @@ pub fn show_cursor() {
|
||||
pub fn hide_cursor() {
|
||||
print('\x1b[?25l')
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user