Skip to content
Myr

Disable resize listening on windows since it's not supported

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Christian Rocha · committed by Christian Rocha · parent a152cce · Browse files · 3 files+37 added−14 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+37 added−14 removed

  • other:+37 added−14 removed

3 files+37 added−14 removed

added:signals_unix.go+27 added
1// +build darwin dragonfly freebsd linux netbsd openbsd solaris23package tea45import (6 "os"7 "os/signal"8 "syscall"910 "golang.org/x/crypto/ssh/terminal"11)1213// listenForResize sends messages (or errors) when the terminal resizes.14// Argument output should be the file descriptor for the terminal; usually15// os.Stdout.16func listenForResize(output *os.File, msgs chan Msg, errs chan error) {17 sig := make(chan os.Signal)18 signal.Notify(sig, syscall.SIGWINCH)19 for {20 <-sig21 w, h, err := terminal.GetSize(int(output.Fd()))22 if err != nil {23 errs <- err24 }25 msgs <- WindowSizeMsg{w, h}26 }27}
added:signals_windows.go+9 added
1// +build windows23package tea45import "os"67// listenForResize is not available on windows because windows does not8// implement syscall.SIGWINCH.9func listenForResize(output *os.File, msgs chan Msg, errs chan error) {}
modified:tea.go+1 added-14 removed
1package tea23import (4 "os"5 "os/signal"6 "syscall"56 "github.com/muesli/termenv"7 "golang.org/x/crypto/ssh/terminal"8)
120 unmodified lines
129 msgs <- WindowSizeMsg{w, h}130 }()131132 // Listen for window resizes135 go func() {136 sig := make(chan os.Signal)137 signal.Notify(sig, syscall.SIGWINCH)138 for {139 <-sig140 w, h, err := terminal.GetSize(int(output.Fd()))141 if err != nil {142 errs <- err143 }144 msgs <- WindowSizeMsg{w, h}145 }146 }()133 go listenForResize(output, msgs, errs)134135 // Process commands136 go func() {137 for {
73 unmodified lines