Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid modifying saved terminal state #263

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/term/raw.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ func SetRaw(fd int) error {
n.Cc[syscall.VMIN] = 1
n.Cc[syscall.VTIME] = 0

return termios.Tcsetattr(uintptr(fd), termios.TCSANOW, (*unix.Termios)(n))
return termios.Tcsetattr(uintptr(fd), termios.TCSANOW, (*unix.Termios)(&n))
}
6 changes: 3 additions & 3 deletions internal/term/term.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ var (
saveTermiosOnce sync.Once
)

func getOriginalTermios(fd int) (*unix.Termios, error) {
func getOriginalTermios(fd int) (unix.Termios, error) {
var err error
saveTermiosOnce.Do(func() {
saveTermiosFD = fd
saveTermios, err = termios.Tcgetattr(uintptr(fd))
})
return saveTermios, err
return *saveTermios, err
}

// Restore terminal's mode.
Expand All @@ -30,5 +30,5 @@ func Restore() error {
if err != nil {
return err
}
return termios.Tcsetattr(uintptr(saveTermiosFD), termios.TCSANOW, o)
return termios.Tcsetattr(uintptr(saveTermiosFD), termios.TCSANOW, &o)
}