When the tty is /dev/ttyS0, readline gets the term width as 0 (stty size output is 0 0), resulting in invalid tab and infinite loop of arrow keys
w return is 0
|
func GetScreenWidth() int { |
|
w := getWidth(syscall.Stdout) |
|
if w < 0 { |
|
w = getWidth(syscall.Stderr) |
|
} |
|
return w |
|
} |