terminal: cleanup determining width

This commit is contained in:
Michael Eischer
2025-09-07 14:26:42 +02:00
parent 0b0dd07f15
commit 43b5166de8
4 changed files with 10 additions and 8 deletions

View File

@@ -20,8 +20,12 @@ func StdoutCanUpdateStatus() bool {
return CanUpdateStatus(os.Stdout.Fd())
}
func StdoutTerminalWidth() int {
w, _, err := term.GetSize(int(os.Stdout.Fd()))
func StdoutWidth() int {
return Width(os.Stdout.Fd())
}
func Width(fd uintptr) int {
w, _, err := term.GetSize(int(fd))
if err != nil {
return 0
}