switch to golang.org/x/term

This commit is contained in:
Michael Eischer
2022-03-28 22:24:15 +02:00
parent c60540b196
commit 61e179ee78
4 changed files with 13 additions and 12 deletions

View File

@@ -10,7 +10,7 @@ import (
"strings"
"unicode"
"golang.org/x/crypto/ssh/terminal"
"golang.org/x/term"
"golang.org/x/text/width"
)
@@ -321,7 +321,7 @@ func (t *Terminal) SetStatus(lines []string) {
var width int
if t.canUpdateStatus {
var err error
width, _, err = terminal.GetSize(int(t.fd))
width, _, err = term.GetSize(int(t.fd))
if err != nil || width <= 0 {
// use 80 columns by default
width = 80

View File

@@ -7,7 +7,7 @@ import (
"io"
"os"
"golang.org/x/crypto/ssh/terminal"
"golang.org/x/term"
)
// clearCurrentLine removes all characters from the current line and resets the
@@ -24,7 +24,7 @@ func moveCursorUp(wr io.Writer, fd uintptr) func(io.Writer, uintptr, int) {
// CanUpdateStatus returns true if status lines can be printed, the process
// output is not redirected to a file or pipe.
func CanUpdateStatus(fd uintptr) bool {
if !terminal.IsTerminal(int(fd)) {
if !term.IsTerminal(int(fd)) {
return false
}
term := os.Getenv("TERM")