1
1
mirror of https://github.com/walles/moar.git synced 2024-11-13 01:40:46 +03:00

Fix build errors on Unix

This commit is contained in:
Johan Walles 2021-04-17 09:28:45 +02:00
parent ff9380fe15
commit 1e46089cff
2 changed files with 12 additions and 6 deletions

View File

@ -63,3 +63,10 @@ func (screen *UnixScreen) setupTtyInTtyOut() {
screen.ttyOut = os.Stdout
}
func (screen *UnixScreen) restoreTtyInTtyOut() {
err := term.Restore(int(screen.ttyIn.Fd()), screen.oldTerminalState)
if err != nil {
panic(err)
}
}

View File

@ -52,14 +52,14 @@ type UnixScreen struct {
// not this channel has been signalled
sigwinch chan int
events chan Event
oldTerminalState *term.State
events chan Event
ttyIn *os.File
oldTtyInMode uint32 // Used on Windows
ttyIn *os.File
oldTerminalState *term.State //lint:ignore U1000 Not used on Windows
oldTtyInMode uint32 //lint:ignore U1000 Windows only
ttyOut *os.File
oldTtyOutMode uint32 // Used on Windows
oldTtyOutMode uint32 //lint:ignore U1000 Windows only
}
// Cell is a rune with a style to be written to a cell on screen
@ -120,7 +120,6 @@ func (screen *UnixScreen) Close() {
screen.hideCursor(false)
screen.enableMouseTracking(false)
screen.setAlternateScreenMode(false)
term.Restore(int(screen.ttyIn.Fd()), screen.oldTerminalState)
screen.restoreTtyInTtyOut()
}