mirror of
https://github.com/RoBaertschi/tt.git
synced 2025-04-15 21:43:30 +00:00
remove unused raw mode stuff
This commit is contained in:
parent
bae6aa05fc
commit
855bcff9b4
@ -185,6 +185,6 @@ func GetCursorPosition() (row, column int, err error) {
|
||||
}
|
||||
|
||||
func Exit(val int) {
|
||||
LeaveRawMode()
|
||||
// LeaveRawMode()
|
||||
os.Exit(val)
|
||||
}
|
||||
|
@ -1,47 +0,0 @@
|
||||
//go:build unix
|
||||
// +build unix
|
||||
|
||||
package term
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
var restore unix.Termios
|
||||
var rawModeEnabled = false
|
||||
|
||||
func EnterRawMode() error {
|
||||
termios, err := unix.IoctlGetTermios(unix.Stdin, unix.TCGETS)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
restore = *termios
|
||||
termios.Lflag = termios.Lflag &^ (unix.ECHO | unix.ICANON | unix.ISIG | unix.IEXTEN)
|
||||
termios.Iflag = termios.Iflag &^ (unix.IXON | unix.ICRNL | unix.BRKINT | unix.INPCK | unix.ISTRIP)
|
||||
termios.Cflag = termios.Cflag | unix.CS8
|
||||
|
||||
if err := unix.IoctlSetTermios(unix.Stdin, unix.TCSETSF, termios); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
rawModeEnabled = true
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func LeaveRawMode() error {
|
||||
if !rawModeEnabled {
|
||||
return errors.New("raw mode is not enabled")
|
||||
}
|
||||
|
||||
err := unix.IoctlSetTermios(unix.Stdin, unix.TCSETSF, &restore)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
rawModeEnabled = false
|
||||
return nil
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user