Documentation
¶
Index ¶
- Constants
- Variables
- func Headless() bool
- func NewDummyUpdater() *updates.Updater
- func OnFocusWrapper(f func() error) func(opts types.OnFocusOpts) error
- type BackgroundRoutineMgr
- type ContextMgr
- func (self *ContextMgr) ActivateContext(c types.Context, opts types.OnFocusOpts) error
- func (self *ContextMgr) AllFilterable() []types.IFilterableContext
- func (self *ContextMgr) AllList() []types.IListContext
- func (self *ContextMgr) AllPatchExplorer() []types.IPatchExplorerContext
- func (self *ContextMgr) AllSearchable() []types.ISearchableContext
- func (self *ContextMgr) ContextForKey(key types.ContextKey) types.Context
- func (self *ContextMgr) Current() types.Context
- func (self *ContextMgr) CurrentSide() types.Context
- func (self *ContextMgr) CurrentStatic() types.Context
- func (self *ContextMgr) ForEach(f func(types.Context))
- func (self *ContextMgr) IsCurrent(c types.Context) bool
- func (self *ContextMgr) Pop() error
- func (self *ContextMgr) Push(c types.Context, opts ...types.OnFocusOpts) error
- func (self *ContextMgr) RemoveContexts(contextsToRemove []types.Context) error
- func (self *ContextMgr) Replace(c types.Context) error
- type Gui
- func (gui *Gui) Contexts() *context.ContextTree
- func (self *Gui) GetCheatsheetKeybindings() []*types.Binding
- func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBinding)
- func (self *Gui) GetInitialKeybindingsWithCustomCommands() ([]*types.Binding, []*gocui.ViewMouseBinding)
- func (gui *Gui) Helpers() *helpers.Helpers
- func (gui *Gui) LogAction(action string)
- func (gui *Gui) LogCommand(cmdStr string, commandLine bool)
- func (gui *Gui) RefreshMainView(opts *types.ViewUpdateOpts, context types.Context) error
- func (gui *Gui) Run(startArgs appTypes.StartArgs) error
- func (gui *Gui) RunAndHandleError(startArgs appTypes.StartArgs) error
- func (gui *Gui) SetKeybinding(binding *types.Binding) error
- func (gui *Gui) SetMouseKeybinding(binding *gocui.ViewMouseBinding) error
- type GuiDriver
- func (self *GuiDriver) CheckAllToastsAcknowledged()
- func (self *GuiDriver) CheckedOutRef() *models.Branch
- func (self *GuiDriver) Click(x, y int)
- func (self *GuiDriver) ContextForView(viewName string) types.Context
- func (self *GuiDriver) CurrentContext() types.Context
- func (self *GuiDriver) Fail(message string)
- func (self *GuiDriver) Keys() config.KeybindingConfig
- func (self *GuiDriver) Log(message string)
- func (self *GuiDriver) LogUI(message string)
- func (self *GuiDriver) MainView() *gocui.View
- func (self *GuiDriver) NextToast() *string
- func (self *GuiDriver) PressKey(keyStr string)
- func (self *GuiDriver) SecondaryView() *gocui.View
- func (self *GuiDriver) SetCaption(caption string)
- func (self *GuiDriver) SetCaptionPrefix(prefix string)
- func (self *GuiDriver) View(viewName string) *gocui.View
- type GuiRepoState
- func (self *GuiRepoState) GetCurrentPopupOpts() *types.CreatePopupPanelOpts
- func (self *GuiRepoState) GetScreenMode() types.WindowMaximisation
- func (self *GuiRepoState) GetSearchState() *types.SearchState
- func (self *GuiRepoState) GetSplitMainPanel() bool
- func (self *GuiRepoState) GetStartupStage() types.StartupStage
- func (self *GuiRepoState) GetViewsSetup() bool
- func (self *GuiRepoState) GetWindowViewNameMap() *utils.ThreadSafeMap[string, string]
- func (self *GuiRepoState) InSearchPrompt() bool
- func (self *GuiRepoState) SetCurrentPopupOpts(value *types.CreatePopupPanelOpts)
- func (self *GuiRepoState) SetScreenMode(value types.WindowMaximisation)
- func (self *GuiRepoState) SetSplitMainPanel(value bool)
- func (self *GuiRepoState) SetStartupStage(value types.StartupStage)
- type IntegrationTest
- type OptionsMapMgr
- type PrevLayout
- type Repo
- type StateAccessor
- func (self *StateAccessor) ClearItemOperation(item types.HasUrn)
- func (self *StateAccessor) GetIsRefreshingFiles() bool
- func (self *StateAccessor) GetItemOperation(item types.HasUrn) types.ItemOperation
- func (self *StateAccessor) GetRepoPathStack() *utils.StringStack
- func (self *StateAccessor) GetRepoState() types.IRepoStateAccessor
- func (self *StateAccessor) GetRetainOriginalDir() bool
- func (self *StateAccessor) GetShowExtrasWindow() bool
- func (self *StateAccessor) GetUpdating() bool
- func (self *StateAccessor) SetIsRefreshingFiles(value bool)
- func (self *StateAccessor) SetItemOperation(item types.HasUrn, operation types.ItemOperation)
- func (self *StateAccessor) SetRetainOriginalDir(value bool)
- func (self *StateAccessor) SetShowExtrasWindow(value bool)
- func (self *StateAccessor) SetUpdating(value bool)
Constants ¶
const HORIZONTAL_SCROLL_FACTOR = 3
const StartupPopupVersion = 5
Variables ¶
var OverlappingEdges = false
OverlappingEdges determines if panel edges overlap
var RuneReplacements = map[rune]string{ graph.MergeSymbol: "M", graph.CommitSymbol: "o", }
Functions ¶
func NewDummyUpdater ¶
func OnFocusWrapper ¶
func OnFocusWrapper(f func() error) func(opts types.OnFocusOpts) error
using this wrapper for when an onFocus function doesn't care about any potential props that could be passed
Types ¶
type BackgroundRoutineMgr ¶
type BackgroundRoutineMgr struct {
// contains filtered or unexported fields
}
func (*BackgroundRoutineMgr) PauseBackgroundRefreshes ¶
func (self *BackgroundRoutineMgr) PauseBackgroundRefreshes(pause bool)
type ContextMgr ¶
type ContextMgr struct { ContextStack []types.Context sync.RWMutex // contains filtered or unexported fields }
func NewContextMgr ¶
func NewContextMgr( gui *Gui, allContexts *context.ContextTree, ) *ContextMgr
func (*ContextMgr) ActivateContext ¶
func (self *ContextMgr) ActivateContext(c types.Context, opts types.OnFocusOpts) error
func (*ContextMgr) AllFilterable ¶
func (self *ContextMgr) AllFilterable() []types.IFilterableContext
func (*ContextMgr) AllList ¶
func (self *ContextMgr) AllList() []types.IListContext
all list contexts
func (*ContextMgr) AllPatchExplorer ¶
func (self *ContextMgr) AllPatchExplorer() []types.IPatchExplorerContext
func (*ContextMgr) AllSearchable ¶
func (self *ContextMgr) AllSearchable() []types.ISearchableContext
func (*ContextMgr) ContextForKey ¶
func (self *ContextMgr) ContextForKey(key types.ContextKey) types.Context
func (*ContextMgr) Current ¶
func (self *ContextMgr) Current() types.Context
func (*ContextMgr) CurrentSide ¶
func (self *ContextMgr) CurrentSide() types.Context
Note that this could return the 'status' context which is not itself a list context.
func (*ContextMgr) CurrentStatic ¶
func (self *ContextMgr) CurrentStatic() types.Context
static as opposed to popup
func (*ContextMgr) ForEach ¶
func (self *ContextMgr) ForEach(f func(types.Context))
func (*ContextMgr) Pop ¶
func (self *ContextMgr) Pop() error
func (*ContextMgr) Push ¶
func (self *ContextMgr) Push(c types.Context, opts ...types.OnFocusOpts) error
func (*ContextMgr) RemoveContexts ¶
func (self *ContextMgr) RemoveContexts(contextsToRemove []types.Context) error
type Gui ¶
type Gui struct { *common.Common // this is the state of the GUI for the current repo State *GuiRepoState CustomCommandsClient *custom_commands.Client // this is a mapping of repos to gui states, so that we can restore the original // gui state when returning from a subrepo. // In repos with multiple worktrees, we store a separate repo state per worktree. RepoStateMap map[Repo]*GuiRepoState Config config.AppConfigurer Updater *updates.Updater Mutexes types.Mutexes // when you enter into a submodule we'll append the superproject's path to this array // so that you can return to the superproject RepoPathStack *utils.StringStack // this tells us whether our views have been initially set up ViewsSetup bool Views types.Views // Log of the commands/actions logged in the Command Log panel. GuiLog []string // the extras window contains things like the command log ShowExtrasWindow bool PopupHandler types.IPopupHandler IsNewRepo bool IsRefreshingFiles bool // we use this to decide whether we'll return to the original directory that // lazygit was opened in, or if we'll retain the one we're currently in. RetainOriginalDir bool PrevLayout PrevLayout // this is the initial dir we are in upon opening lazygit. We hold onto this // in case we want to restore it before quitting for users who have set up // the feature for changing directory upon quit. // The reason we don't just wait until quit time to handle changing directories // is because some users want to keep track of the current lazygit directory in an outside // process InitialDir string BackgroundRoutineMgr *BackgroundRoutineMgr Updating bool // contains filtered or unexported fields }
Gui wraps the gocui Gui object which handles rendering and events
func NewGui ¶
func NewGui( cmn *common.Common, config config.AppConfigurer, gitVersion *git_commands.GitVersion, updater *updates.Updater, showRecentRepos bool, initialDir string, test integrationTypes.IntegrationTest, ) (*Gui, error)
for now the split view will always be on NewGui builds a new gui handler
func (*Gui) Contexts ¶
func (gui *Gui) Contexts() *context.ContextTree
func (*Gui) GetCheatsheetKeybindings ¶
only to be called from the cheatsheet generate script. This mutates the Gui struct.
func (*Gui) GetInitialKeybindings ¶
func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBinding)
renaming receiver to 'self' to aid refactoring. Will probably end up moving all Gui handlers to this pattern eventually.
func (*Gui) GetInitialKeybindingsWithCustomCommands ¶
func (self *Gui) GetInitialKeybindingsWithCustomCommands() ([]*types.Binding, []*gocui.ViewMouseBinding)
func (*Gui) LogAction ¶
our UI command log looks like this: Stage File: git add -- 'filename' Unstage File: git reset HEAD 'filename'
The 'Stage File' and 'Unstage File' lines are actions i.e they group up a set of command logs (typically there's only one command under an action but there may be more). So we call logAction to log the 'Stage File' part and then we call logCommand to log the command itself. We pass logCommand to our OSCommand struct so that it can handle logging commands for us.
func (*Gui) LogCommand ¶
func (*Gui) RefreshMainView ¶
func (*Gui) RunAndHandleError ¶
func (*Gui) SetMouseKeybinding ¶
func (gui *Gui) SetMouseKeybinding(binding *gocui.ViewMouseBinding) error
warning: mutates the binding
type GuiDriver ¶
type GuiDriver struct {
// contains filtered or unexported fields
}
this gives our integration test a way of interacting with the gui for sending keypresses and reading state.
func (*GuiDriver) CheckAllToastsAcknowledged ¶
func (self *GuiDriver) CheckAllToastsAcknowledged()
func (*GuiDriver) CheckedOutRef ¶
func (*GuiDriver) ContextForView ¶
func (*GuiDriver) CurrentContext ¶
func (*GuiDriver) Keys ¶
func (self *GuiDriver) Keys() config.KeybindingConfig
func (*GuiDriver) Log ¶
logs to the normal place that you log to i.e. viewable with `lazygit --logs`
func (*GuiDriver) SecondaryView ¶
func (*GuiDriver) SetCaption ¶
func (*GuiDriver) SetCaptionPrefix ¶
type GuiRepoState ¶
type GuiRepoState struct { Model *types.Model Modes *types.Modes SplitMainPanel bool LimitCommits bool SearchState *types.SearchState StartupStage types.StartupStage // Allows us to not load everything at once ContextMgr *ContextMgr Contexts *context.ContextTree // WindowViewNameMap is a mapping of windows to the current view of that window. // Some views move between windows for example the commitFiles view and when cycling through // side windows we need to know which view to give focus to for a given window WindowViewNameMap *utils.ThreadSafeMap[string, string] // tells us whether we've set up our views for the current repo. We'll need to // do this whenever we switch back and forth between repos to get the views // back in sync with the repo state ViewsSetup bool ScreenMode types.WindowMaximisation CurrentPopupOpts *types.CreatePopupPanelOpts }
func (*GuiRepoState) GetCurrentPopupOpts ¶
func (self *GuiRepoState) GetCurrentPopupOpts() *types.CreatePopupPanelOpts
func (*GuiRepoState) GetScreenMode ¶
func (self *GuiRepoState) GetScreenMode() types.WindowMaximisation
func (*GuiRepoState) GetSearchState ¶
func (self *GuiRepoState) GetSearchState() *types.SearchState
func (*GuiRepoState) GetSplitMainPanel ¶
func (self *GuiRepoState) GetSplitMainPanel() bool
func (*GuiRepoState) GetStartupStage ¶
func (self *GuiRepoState) GetStartupStage() types.StartupStage
func (*GuiRepoState) GetViewsSetup ¶
func (self *GuiRepoState) GetViewsSetup() bool
func (*GuiRepoState) GetWindowViewNameMap ¶
func (self *GuiRepoState) GetWindowViewNameMap() *utils.ThreadSafeMap[string, string]
func (*GuiRepoState) InSearchPrompt ¶
func (self *GuiRepoState) InSearchPrompt() bool
func (*GuiRepoState) SetCurrentPopupOpts ¶
func (self *GuiRepoState) SetCurrentPopupOpts(value *types.CreatePopupPanelOpts)
func (*GuiRepoState) SetScreenMode ¶
func (self *GuiRepoState) SetScreenMode(value types.WindowMaximisation)
func (*GuiRepoState) SetSplitMainPanel ¶
func (self *GuiRepoState) SetSplitMainPanel(value bool)
func (*GuiRepoState) SetStartupStage ¶
func (self *GuiRepoState) SetStartupStage(value types.StartupStage)
type IntegrationTest ¶
type IntegrationTest interface {
Run(*GuiDriver)
}
type OptionsMapMgr ¶
type OptionsMapMgr struct {
// contains filtered or unexported fields
}
type PrevLayout ¶
we keep track of some stuff from one render to the next to see if certain things have changed
type StateAccessor ¶
type StateAccessor struct {
// contains filtered or unexported fields
}
func (*StateAccessor) ClearItemOperation ¶
func (self *StateAccessor) ClearItemOperation(item types.HasUrn)
func (*StateAccessor) GetIsRefreshingFiles ¶
func (self *StateAccessor) GetIsRefreshingFiles() bool
func (*StateAccessor) GetItemOperation ¶
func (self *StateAccessor) GetItemOperation(item types.HasUrn) types.ItemOperation
func (*StateAccessor) GetRepoPathStack ¶
func (self *StateAccessor) GetRepoPathStack() *utils.StringStack
func (*StateAccessor) GetRepoState ¶
func (self *StateAccessor) GetRepoState() types.IRepoStateAccessor
func (*StateAccessor) GetRetainOriginalDir ¶
func (self *StateAccessor) GetRetainOriginalDir() bool
func (*StateAccessor) GetShowExtrasWindow ¶
func (self *StateAccessor) GetShowExtrasWindow() bool
func (*StateAccessor) GetUpdating ¶
func (self *StateAccessor) GetUpdating() bool
func (*StateAccessor) SetIsRefreshingFiles ¶
func (self *StateAccessor) SetIsRefreshingFiles(value bool)
func (*StateAccessor) SetItemOperation ¶
func (self *StateAccessor) SetItemOperation(item types.HasUrn, operation types.ItemOperation)
func (*StateAccessor) SetRetainOriginalDir ¶
func (self *StateAccessor) SetRetainOriginalDir(value bool)
func (*StateAccessor) SetShowExtrasWindow ¶
func (self *StateAccessor) SetShowExtrasWindow(value bool)
func (*StateAccessor) SetUpdating ¶
func (self *StateAccessor) SetUpdating(value bool)
Source Files
¶
- background.go
- command_log_panel.go
- context.go
- context_config.go
- controllers.go
- dummies.go
- editors.go
- extras_panel.go
- global_handlers.go
- gui.go
- gui_common.go
- gui_driver.go
- information_panel.go
- keybindings.go
- layout.go
- main_panels.go
- menu_panel.go
- options_map.go
- pty.go
- recent_repos_panel.go
- tasks_adapter.go
- test_mode.go
- view_helpers.go
- views.go