1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-11-24 08:52:21 +02:00

support alacritty

This commit is contained in:
Jesse Duffield 2020-08-23 20:20:05 +10:00
parent f172f20219
commit 44ee28bb2e
6 changed files with 14 additions and 12 deletions

2
go.mod
View File

@ -14,7 +14,7 @@ require (
github.com/google/go-cmp v0.3.1 // indirect github.com/google/go-cmp v0.3.1 // indirect
github.com/integrii/flaggy v1.4.0 github.com/integrii/flaggy v1.4.0
github.com/jesseduffield/gocui v0.3.1-0.20200823073938-1a970a28d894 github.com/jesseduffield/gocui v0.3.1-0.20200823073938-1a970a28d894
github.com/jesseduffield/termbox-go v0.0.0-20200405031649-4dc645f7e8ba // indirect github.com/jesseduffield/termbox-go v0.0.0-20200823212418-a2289ed6aafe // indirect
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/mattn/go-colorable v0.1.4 // indirect github.com/mattn/go-colorable v0.1.4 // indirect

2
go.sum
View File

@ -100,6 +100,8 @@ github.com/jesseduffield/termbox-go v0.0.0-20200130214842-1d31d1faa3c9 h1:iBBk1l
github.com/jesseduffield/termbox-go v0.0.0-20200130214842-1d31d1faa3c9/go.mod h1:anMibpZtqNxjDbxrcDEAwSdaJ37vyUeM1f/M4uekib4= github.com/jesseduffield/termbox-go v0.0.0-20200130214842-1d31d1faa3c9/go.mod h1:anMibpZtqNxjDbxrcDEAwSdaJ37vyUeM1f/M4uekib4=
github.com/jesseduffield/termbox-go v0.0.0-20200405031649-4dc645f7e8ba h1:hWBdYchM9nZ2+GldroQQ627ISOC83iRDdpfwY+uyJeI= github.com/jesseduffield/termbox-go v0.0.0-20200405031649-4dc645f7e8ba h1:hWBdYchM9nZ2+GldroQQ627ISOC83iRDdpfwY+uyJeI=
github.com/jesseduffield/termbox-go v0.0.0-20200405031649-4dc645f7e8ba/go.mod h1:anMibpZtqNxjDbxrcDEAwSdaJ37vyUeM1f/M4uekib4= github.com/jesseduffield/termbox-go v0.0.0-20200405031649-4dc645f7e8ba/go.mod h1:anMibpZtqNxjDbxrcDEAwSdaJ37vyUeM1f/M4uekib4=
github.com/jesseduffield/termbox-go v0.0.0-20200823212418-a2289ed6aafe h1:qsVhCf2RFyyKIUe/+gJblbCpXMUki9rZrHuEctg6M/E=
github.com/jesseduffield/termbox-go v0.0.0-20200823212418-a2289ed6aafe/go.mod h1:anMibpZtqNxjDbxrcDEAwSdaJ37vyUeM1f/M4uekib4=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=

View File

@ -411,8 +411,6 @@ func (gui *Gui) Run() error {
g.NextSearchMatchKey = gui.getKey("universal.nextMatch") g.NextSearchMatchKey = gui.getKey("universal.nextMatch")
g.PrevSearchMatchKey = gui.getKey("universal.prevMatch") g.PrevSearchMatchKey = gui.getKey("universal.prevMatch")
gui.stopChan = make(chan struct{})
g.ASCII = runtime.GOOS == "windows" && runewidth.IsEastAsian() g.ASCII = runtime.GOOS == "windows" && runewidth.IsEastAsian()
if gui.Config.GetUserConfig().GetBool("gui.mouseEvents") { if gui.Config.GetUserConfig().GetBool("gui.mouseEvents") {
@ -453,6 +451,7 @@ func (gui *Gui) Run() error {
// otherwise it handles the error, possibly by quitting the application // otherwise it handles the error, possibly by quitting the application
func (gui *Gui) RunWithSubprocesses() error { func (gui *Gui) RunWithSubprocesses() error {
for { for {
gui.stopChan = make(chan struct{})
if err := gui.Run(); err != nil { if err := gui.Run(); err != nil {
for _, manager := range gui.viewBufferManagerMap { for _, manager := range gui.viewBufferManagerMap {
manager.Close() manager.Close()
@ -465,28 +464,27 @@ func (gui *Gui) RunWithSubprocesses() error {
close(gui.stopChan) close(gui.stopChan)
if err == gocui.ErrQuit { switch err {
case gocui.ErrQuit:
if !gui.State.RetainOriginalDir { if !gui.State.RetainOriginalDir {
if err := gui.recordCurrentDirectory(); err != nil { if err := gui.recordCurrentDirectory(); err != nil {
return err return err
} }
} }
break return nil
} else if err == gui.Errors.ErrSwitchRepo { case gui.Errors.ErrSwitchRepo, gui.Errors.ErrRestart:
continue continue
} else if err == gui.Errors.ErrRestart { case gui.Errors.ErrSubProcess:
continue
} else if err == gui.Errors.ErrSubProcess {
if err := gui.runCommand(); err != nil { if err := gui.runCommand(); err != nil {
return err return err
} }
} else { default:
return err return err
} }
} }
} }
return nil
} }
func (gui *Gui) runCommand() error { func (gui *Gui) runCommand() error {

View File

@ -123,6 +123,7 @@ func setup_term_builtin() error {
// let's assume that 'cygwin' is xterm compatible // let's assume that 'cygwin' is xterm compatible
{"cygwin", xterm_keys, xterm_funcs}, {"cygwin", xterm_keys, xterm_funcs},
{"st", xterm_keys, xterm_funcs}, {"st", xterm_keys, xterm_funcs},
{"alacritty", xterm_keys, xterm_funcs},
} }
// try compatibility variants // try compatibility variants

View File

@ -61,4 +61,5 @@ var terms = []struct {
{"rxvt-unicode", rxvt_unicode_keys, rxvt_unicode_funcs}, {"rxvt-unicode", rxvt_unicode_keys, rxvt_unicode_funcs},
{"linux", linux_keys, linux_funcs}, {"linux", linux_keys, linux_funcs},
{"rxvt-256color", rxvt_256color_keys, rxvt_256color_funcs}, {"rxvt-256color", rxvt_256color_keys, rxvt_256color_funcs},
{"alacritty", xterm_keys, xterm_funcs},
} }

2
vendor/modules.txt vendored
View File

@ -102,7 +102,7 @@ github.com/jbenet/go-context/io
# github.com/jesseduffield/gocui v0.3.1-0.20200823073938-1a970a28d894 # github.com/jesseduffield/gocui v0.3.1-0.20200823073938-1a970a28d894
## explicit ## explicit
github.com/jesseduffield/gocui github.com/jesseduffield/gocui
# github.com/jesseduffield/termbox-go v0.0.0-20200405031649-4dc645f7e8ba # github.com/jesseduffield/termbox-go v0.0.0-20200823212418-a2289ed6aafe
## explicit ## explicit
github.com/jesseduffield/termbox-go github.com/jesseduffield/termbox-go
# github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 # github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0