1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-12-01 22:52:01 +02:00

start refactoring gui

This commit is contained in:
Jesse Duffield
2022-01-28 20:44:36 +11:00
parent fa8571e1f4
commit a90b6efded
61 changed files with 1779 additions and 1522 deletions

View File

@@ -0,0 +1,18 @@
package types
import "github.com/jesseduffield/gocui"
// Binding - a keybinding mapping a key and modifier to a handler. The keypress
// is only handled if the given view has focus, or handled globally if the view
// is ""
type Binding struct {
ViewName string
Contexts []string
Handler func() error
Key interface{} // FIXME: find out how to get `gocui.Key | rune`
Modifier gocui.Modifier
Description string
Alternative string
Tag string // e.g. 'navigation'. Used for grouping things in the cheatsheet
OpensMenu bool
}

32
pkg/gui/types/refresh.go Normal file
View File

@@ -0,0 +1,32 @@
package types
// models/views that we can refresh
type RefreshableView int
const (
COMMITS RefreshableView = iota
BRANCHES
FILES
STASH
REFLOG
TAGS
REMOTES
STATUS
SUBMODULES
// not actually a view. Will refactor this later
BISECT_INFO
)
type RefreshMode int
const (
SYNC RefreshMode = iota // wait until everything is done before returning
ASYNC // return immediately, allowing each independent thing to update itself
BLOCK_UI // wrap code in an update call to ensure UI updates all at once and keybindings aren't executed till complete
)
type RefreshOptions struct {
Then func()
Scope []RefreshableView // e.g. []int{COMMITS, BRANCHES}. Leave empty to refresh everything
Mode RefreshMode // one of SYNC (default), ASYNC, and BLOCK_UI
}