diff --git a/backend_windows.go b/backend_windows.go index 6077876..58c1ca0 100644 --- a/backend_windows.go +++ b/backend_windows.go @@ -33,10 +33,6 @@ func newBackend() Backend { } func (b *windowsBackend) Init() error { - if os.Getenv("WT_SESSION") == "" && os.Getenv("WT_PROFILE_ID") == "" { - return fmt.Errorf("Windows Terminal required: WT_SESSION unset; conhost lacks alt screen") - } - if err := windows.GetConsoleMode(b.stdin, &b.oldStdinMode); err != nil { return fmt.Errorf("GetConsoleMode stdin: %w", err) } diff --git a/detect_unix.go b/detect_unix.go index 0342918..3ea3373 100644 --- a/detect_unix.go +++ b/detect_unix.go @@ -43,10 +43,10 @@ func resetTerminalMode() { defer tty.Close() fd := int(tty.Fd()) // Get current termios, enable ECHO and ICANON - if termios, err := unix.IoctlGetTermios(fd, unix.TCGETS); err == nil { + if termios, err := unix.IoctlGetTermios(fd, tcgets); err == nil { termios.Lflag |= unix.ECHO | unix.ICANON | unix.ISIG | unix.IEXTEN termios.Iflag |= unix.ICRNL - unix.IoctlSetTermios(fd, unix.TCSETS, termios) + unix.IoctlSetTermios(fd, tcsets, termios) } } -} \ No newline at end of file +} diff --git a/go.mod b/go.mod index e462937..1d928ab 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,9 @@ module github.com/lixenwraith/terminal -go 1.26.0 +go 1.27.1 require ( github.com/lixenwraith/color v0.0.0-20260719094342-615e11bc7897 - golang.org/x/sys v0.47.0 - golang.org/x/term v0.45.0 + golang.org/x/sys v0.48.0 + golang.org/x/term v0.46.0 ) diff --git a/go.sum b/go.sum index 659d5b2..809fa9d 100644 --- a/go.sum +++ b/go.sum @@ -4,5 +4,9 @@ github.com/lixenwraith/color v0.0.0-20260719094342-615e11bc7897 h1:YkTK1vIzG6sqK github.com/lixenwraith/color v0.0.0-20260719094342-615e11bc7897/go.mod h1:p02MsAGqlmZu3sc6BPYCKmaedF+lqBoijnuu5cOrYeo= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= +golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= golang.org/x/term v0.45.0 h1:NwWyBmoJCbfTHpxrWoZ9C6/VxOf7ic219I8xZZFdrf0= golang.org/x/term v0.45.0/go.mod h1:9aqxs0blBcrm/n0L9QW0aRVD+ktan8ssZromtqJC43w= +golang.org/x/term v0.46.0 h1:3+OXuTbaKDgwk8jTi3aSLHRlmWqHEUDUtxnbFigO4YE= +golang.org/x/term v0.46.0/go.mod h1:+K02xbkittuwc0Am4abfA3Fc+XRGXkvBXNO88NCXPoc= diff --git a/termios_bsd.go b/termios_bsd.go new file mode 100644 index 0000000..19411db --- /dev/null +++ b/termios_bsd.go @@ -0,0 +1,10 @@ +//go:build darwin || dragonfly || freebsd || netbsd || openbsd + +package terminal + +import "golang.org/x/sys/unix" + +const ( + tcgets = unix.TIOCGETA + tcsets = unix.TIOCSETA +) diff --git a/termios_sysv.go b/termios_sysv.go new file mode 100644 index 0000000..2e9c461 --- /dev/null +++ b/termios_sysv.go @@ -0,0 +1,10 @@ +//go:build aix || linux || solaris || zos + +package terminal + +import "golang.org/x/sys/unix" + +const ( + tcgets = unix.TCGETS + tcsets = unix.TCSETS +)