Replace golang.org/x/crypto/ssh/terminal with golang.org/x/term (#2395)

See https://github.com/golang/go/issues/31044
This commit is contained in:
Mitsuo Heijo
2021-03-20 14:38:34 +09:00
committed by GitHub
parent 8edfd14a37
commit 2e353aee96
4 changed files with 14 additions and 23 deletions

View File

@@ -10,7 +10,7 @@ import (
"syscall"
"github.com/junegunn/fzf/src/util"
"golang.org/x/crypto/ssh/terminal"
"golang.org/x/term"
)
func IsLightRendererSupported() bool {
@@ -34,12 +34,12 @@ func (r *LightRenderer) fd() int {
func (r *LightRenderer) initPlatform() error {
fd := r.fd()
origState, err := terminal.GetState(fd)
origState, err := term.GetState(fd)
if err != nil {
return err
}
r.origState = origState
terminal.MakeRaw(fd)
term.MakeRaw(fd)
return nil
}
@@ -63,15 +63,15 @@ func openTtyIn() *os.File {
}
func (r *LightRenderer) setupTerminal() {
terminal.MakeRaw(r.fd())
term.MakeRaw(r.fd())
}
func (r *LightRenderer) restoreTerminal() {
terminal.Restore(r.fd(), r.origState)
term.Restore(r.fd(), r.origState)
}
func (r *LightRenderer) updateTerminalSize() {
width, height, err := terminal.GetSize(r.fd())
width, height, err := term.GetSize(r.fd())
if err == nil {
r.width = width