use x/term instead of stty/pause to prompt any key

cc #480
This commit is contained in:
Gokcehan committed 2021-02-21 18:01:20 +03:00
1 parent c071e37316
commit 2c3cd35a5d
6 files changed
+17 -33

No files matched your search

+13
View File
@@ -17,6 +17,7 @@ import (
"github.com/gdamore/tcell/v2"
"github.com/mattn/go-runewidth"
"golang.org/x/term"
)
const gEscapeCode = 27
@@ -1151,6 +1152,18 @@ func (ui *ui) resume() {
ui.screen.Resume()
}
func anyKey() {
oldState, err := term.MakeRaw(int(os.Stdin.Fd()))
if err != nil {
panic(err)
}
defer term.Restore(int(os.Stdin.Fd()), oldState)
fmt.Print("Press any key to continue")
b := make([]byte, 1)
os.Stdin.Read(b)
}
func listMatches(screen tcell.Screen, matches []string) (*bytes.Buffer, error) {
b := new(bytes.Buffer)