diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index 15167cd..0000000 --- a/AUTHORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code refers to The Go Authors for copyright purposes. -# The master list of authors is in the main Go distribution, -# visible at http://tip.golang.org/AUTHORS. diff --git a/CONTRIBUTORS b/CONTRIBUTORS deleted file mode 100644 index 1c4577e..0000000 --- a/CONTRIBUTORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code was written by the Go contributors. -# The master list of contributors is in the main Go distribution, -# visible at http://tip.golang.org/CONTRIBUTORS. diff --git a/go.mod b/go.mod index edf0e5b..5a4a49c 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module golang.org/x/term go 1.17 -require golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 +require golang.org/x/sys v0.9.0 diff --git a/go.sum b/go.sum index ff13213..cb35c1f 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,2 @@ -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/term.go b/term.go index d592708..1a40d10 100644 --- a/term.go +++ b/term.go @@ -7,11 +7,11 @@ // // Putting a terminal into raw mode is the most common requirement: // -// oldState, err := term.MakeRaw(int(os.Stdin.Fd())) -// if err != nil { -// panic(err) -// } -// defer term.Restore(int(os.Stdin.Fd()), oldState) +// oldState, err := term.MakeRaw(int(os.Stdin.Fd())) +// if err != nil { +// panic(err) +// } +// defer term.Restore(int(os.Stdin.Fd()), oldState) // // Note that on non-Unix systems os.Stdin.Fd() may not be 0. package term diff --git a/term_test.go b/term_test.go index ec1db03..561f3d4 100644 --- a/term_test.go +++ b/term_test.go @@ -5,7 +5,6 @@ package term_test import ( - "io/ioutil" "os" "runtime" "testing" @@ -14,7 +13,7 @@ import ( ) func TestIsTerminalTempFile(t *testing.T) { - file, err := ioutil.TempFile("", "TestIsTerminalTempFile") + file, err := os.CreateTemp("", "TestIsTerminalTempFile") if err != nil { t.Fatal(err) } diff --git a/terminal.go b/terminal.go index 535ab82..f636667 100644 --- a/terminal.go +++ b/terminal.go @@ -233,7 +233,6 @@ func (t *Terminal) queue(data []rune) { t.outBuf = append(t.outBuf, []byte(string(data))...) } -var eraseUnderCursor = []rune{' ', keyEscape, '[', 'D'} var space = []rune{' '} func isPrintable(key rune) bool { @@ -935,7 +934,7 @@ func (s *stRingBuffer) Add(a string) { // next most recent, and so on. If such an element doesn't exist then ok is // false. func (s *stRingBuffer) NthPreviousEntry(n int) (value string, ok bool) { - if n >= s.size { + if n < 0 || n >= s.size { return "", false } index := s.head - n