1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-08-07 22:02:56 +03:00

bump tcell

This commit is contained in:
Jesse Duffield
2021-06-05 22:17:49 +10:00
parent fb395bca6e
commit 82022615dd
183 changed files with 7624 additions and 13146 deletions

View File

@@ -17,7 +17,6 @@
package tcell
import (
"os"
"syscall"
"golang.org/x/sys/unix"
@@ -25,26 +24,18 @@ import (
// BSD systems use TIOC style ioctls.
// nonBlocking changes VMIN to 0, and VTIME to 1. This basically ensures that
// we can wake up the input loop. We only want to do this if we are going to interrupt
// that loop. Normally we use VMIN 1 and VTIME 0, which ensures we pick up bytes when
// they come but don't spin burning cycles.
func (t *tScreen) nonBlocking(on bool) {
fd := int(os.Stdin.Fd())
// tcSetBufParams is used by the tty driver on UNIX systems to configure the
// buffering parameters (minimum character count and minimum wait time in msec.)
func tcSetBufParams(fd int, vMin uint8, vTime uint8) error {
_ = syscall.SetNonblock(fd, true)
tio, err := unix.IoctlGetTermios(fd, unix.TIOCGETA)
if err != nil {
return
return err
}
if on {
tio.Cc[unix.VMIN] = 0
tio.Cc[unix.VTIME] = 0
} else {
// block for any output
tio.Cc[unix.VTIME] = 0
tio.Cc[unix.VMIN] = 1
tio.Cc[unix.VMIN] = vMin
tio.Cc[unix.VTIME] = vTime
if err = unix.IoctlSetTermios(fd, unix.TIOCSETA, tio); err != nil {
return err
}
_ = syscall.SetNonblock(fd, on)
// We want to set this *right now*.
_ = unix.IoctlSetTermios(fd, unix.TIOCSETA, tio)
return nil
}