mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-27 00:51:18 +02:00
bump gocui to stop polling events after closing the gui when switching to a subprocess
This commit is contained in:
4
Gopkg.lock
generated
4
Gopkg.lock
generated
@ -197,11 +197,11 @@
|
|||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
digest = "1:b44cde97053119000e1295929118f935a59787e41c1b4b7db8e7bfdb11db5be1"
|
digest = "1:31a87f65dc451471f411d04742d2cb5ab79a699b8c73666b8fc29f47a8f43f7e"
|
||||||
name = "github.com/jesseduffield/gocui"
|
name = "github.com/jesseduffield/gocui"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
pruneopts = "NUT"
|
pruneopts = "NUT"
|
||||||
revision = "e70eea43593b15d0f70e802771b871c08dacd5ee"
|
revision = "b502ee11d6743144c86226ca0366adaed727214d"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
|
12
vendor/github.com/jesseduffield/gocui/gui.go
generated
vendored
12
vendor/github.com/jesseduffield/gocui/gui.go
generated
vendored
@ -49,6 +49,7 @@ type Gui struct {
|
|||||||
keybindings []*keybinding
|
keybindings []*keybinding
|
||||||
maxX, maxY int
|
maxX, maxY int
|
||||||
outputMode OutputMode
|
outputMode OutputMode
|
||||||
|
stop chan struct{}
|
||||||
|
|
||||||
// BgColor and FgColor allow to configure the background and foreground
|
// BgColor and FgColor allow to configure the background and foreground
|
||||||
// colors of the GUI.
|
// colors of the GUI.
|
||||||
@ -92,6 +93,8 @@ func NewGui(mode OutputMode, supportOverlaps bool) (*Gui, error) {
|
|||||||
g.outputMode = mode
|
g.outputMode = mode
|
||||||
termbox.SetOutputMode(termbox.OutputMode(mode))
|
termbox.SetOutputMode(termbox.OutputMode(mode))
|
||||||
|
|
||||||
|
g.stop = make(chan struct{}, 0)
|
||||||
|
|
||||||
g.tbEvents = make(chan termbox.Event, 20)
|
g.tbEvents = make(chan termbox.Event, 20)
|
||||||
g.userEvents = make(chan userEvent, 20)
|
g.userEvents = make(chan userEvent, 20)
|
||||||
|
|
||||||
@ -110,6 +113,9 @@ func NewGui(mode OutputMode, supportOverlaps bool) (*Gui, error) {
|
|||||||
// Close finalizes the library. It should be called after a successful
|
// Close finalizes the library. It should be called after a successful
|
||||||
// initialization and when gocui is not needed anymore.
|
// initialization and when gocui is not needed anymore.
|
||||||
func (g *Gui) Close() {
|
func (g *Gui) Close() {
|
||||||
|
go func() {
|
||||||
|
g.stop <- struct{}{}
|
||||||
|
}()
|
||||||
termbox.Close()
|
termbox.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,10 +377,16 @@ func (g *Gui) MainLoop() error {
|
|||||||
if err := g.flush(); err != nil {
|
if err := g.flush(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
|
select {
|
||||||
|
case <-g.stop:
|
||||||
|
return
|
||||||
|
default:
|
||||||
g.tbEvents <- termbox.PollEvent()
|
g.tbEvents <- termbox.PollEvent()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
inputMode := termbox.InputAlt
|
inputMode := termbox.InputAlt
|
||||||
|
Reference in New Issue
Block a user