From 2e353aee96502556c503b0a47834aa76edf7b588 Mon Sep 17 00:00:00 2001 From: Mitsuo Heijo <25817501+johejo@users.noreply.github.com> Date: Sat, 20 Mar 2021 14:38:34 +0900 Subject: [PATCH] Replace golang.org/x/crypto/ssh/terminal with golang.org/x/term (#2395) See https://github.com/golang/go/issues/31044 --- go.mod | 4 ++-- go.sum | 17 ++++------------- src/tui/light.go | 4 ++-- src/tui/light_unix.go | 12 ++++++------ 4 files changed, 14 insertions(+), 23 deletions(-) diff --git a/go.mod b/go.mod index 03e7782..c80687f 100644 --- a/go.mod +++ b/go.mod @@ -6,9 +6,9 @@ require ( github.com/mattn/go-runewidth v0.0.9 github.com/mattn/go-shellwords v1.0.10 github.com/saracen/walker v0.1.1 - golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 // indirect - golang.org/x/sys v0.0.0-20201026173827-119d4633e4d1 + golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 + golang.org/x/term v0.0.0-20210317153231-de623e64d2a6 golang.org/x/text v0.3.3 // indirect ) diff --git a/go.sum b/go.sum index e160037..c9c1377 100644 --- a/go.sum +++ b/go.sum @@ -13,25 +13,16 @@ github.com/mattn/go-shellwords v1.0.10 h1:Y7Xqm8piKOO3v10Thp7Z36h4FYFjt5xB//6XvO github.com/mattn/go-shellwords v1.0.10/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y= github.com/saracen/walker v0.1.1 h1:Ou2QIKTWqo0QxhtuHVmtObbmhjMCEUyJ82xp0uV+MGI= github.com/saracen/walker v0.1.1/go.mod h1:0oKYMsKVhSJ+ful4p/XbjvXbMgLEkLITZaxozsl4CGE= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E= -golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756 h1:9nuHUbU8dRnRRfj9KjWUVrJeoexdbeMjttk6Oh1rD10= golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201026173827-119d4633e4d1 h1:/DtoiOYKoQCcIFXQjz07RnWNPRCbqmSXSpgEzhC9ZHM= -golang.org/x/sys v0.0.0-20201026173827-119d4633e4d1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20210317153231-de623e64d2a6 h1:EC6+IGYTjPpRfv9a2b/6Puw0W+hLtAhkV1tPsXhutqs= +golang.org/x/term v0.0.0-20210317153231-de623e64d2a6/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e h1:FDhOuMEY4JVRztM/gsbk+IKUQ8kj74bxZrgw87eMMVc= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/src/tui/light.go b/src/tui/light.go index a123416..8f83c17 100644 --- a/src/tui/light.go +++ b/src/tui/light.go @@ -12,7 +12,7 @@ import ( "github.com/junegunn/fzf/src/util" - "golang.org/x/crypto/ssh/terminal" + "golang.org/x/term" ) const ( @@ -74,7 +74,7 @@ type LightRenderer struct { clickY []int ttyin *os.File buffer []byte - origState *terminal.State + origState *term.State width int height int yoffset int diff --git a/src/tui/light_unix.go b/src/tui/light_unix.go index 1878870..936a13e 100644 --- a/src/tui/light_unix.go +++ b/src/tui/light_unix.go @@ -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