1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-05 00:59:19 +02:00

use tcell via porting over code from awesome-gocui

This commit is contained in:
Jesse Duffield
2020-12-24 14:45:59 +11:00
parent 8901d11674
commit 6a6024e38f
309 changed files with 28156 additions and 5896 deletions

View File

@ -7,7 +7,7 @@ Package gocui allows to create console user interfaces.
Create a new GUI:
g, err := gocui.NewGui(gocui.OutputNormal)
g, err := gocui.NewGui(gocui.OutputNormal, false)
if err != nil {
// handle error
}
@ -16,7 +16,7 @@ Create a new GUI:
// Set GUI managers and key bindings
// ...
if err := g.MainLoop(); err != nil && err != gocui.ErrQuit {
if err := g.MainLoop(); err != nil && !gocui.IsQuit(err) {
// handle error
}
@ -37,8 +37,8 @@ their content. The same is valid for reading.
Create and initialize a view with absolute coordinates:
if v, err := g.SetView("viewname", 2, 2, 22, 7); err != nil {
if err != gocui.ErrUnknownView {
if v, err := g.SetView("viewname", 2, 2, 22, 7, 0); err != nil {
if !gocui.IsUnknownView(err) {
// handle error
}
fmt.Fprintln(v, "This is a new view")
@ -48,7 +48,7 @@ Create and initialize a view with absolute coordinates:
Views can also be created using relative coordinates:
maxX, maxY := g.Size()
if v, err := g.SetView("viewname", maxX/2-30, maxY/2, maxX/2+30, maxY/2+2); err != nil {
if v, err := g.SetView("viewname", maxX/2-30, maxY/2, maxX/2+30, maxY/2+2, 0); err != nil {
// ...
}
@ -84,7 +84,7 @@ use *Gui.Update(). For example:
return nil
})
By default, gocui provides a basic edition mode. This mode can be extended
By default, gocui provides a basic editing mode. This mode can be extended
and customized creating a new Editor and assigning it to *View.Editor:
type Editor interface {