Documentation ¶
Index ¶
- Constants
- Variables
- func Headless() bool
- func NewDummyUpdater() *updates.Updater
- func NewFileWatcher(log *logrus.Entry) *fileWatcher
- 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) 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
- func (gui *Gui) WatchFilesForChanges()
- type GuiDriver
- func (self *GuiDriver) CheckedOutRef() *models.Branch
- 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) PressKey(keyStr string)
- func (self *GuiDriver) SecondaryView() *gocui.View
- 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) GetIgnoreWhitespaceInDiffView() bool
- func (self *StateAccessor) GetIsRefreshingFiles() bool
- 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) SetIgnoreWhitespaceInDiffView(value bool)
- func (self *StateAccessor) SetIsRefreshingFiles(value bool)
- 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 MAX_WATCHED_FILES = 50
macs for some bizarre reason cap the number of watchable files to 256. there's no obvious platform agnostic way to check the situation of the user's computer so we're just arbitrarily capping at 200. This isn't so bad because file watching is only really an added bonus for faster refreshing.
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 ¶ added in v0.30.1
NewDummyGui creates a new dummy GUI for testing
func NewFileWatcher ¶ added in v0.12.1
func OnFocusWrapper ¶ added in v0.32.1
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 ¶ added in v0.39.0
type BackgroundRoutineMgr struct {
// contains filtered or unexported fields
}
func (*BackgroundRoutineMgr) PauseBackgroundRefreshes ¶ added in v0.39.0
func (self *BackgroundRoutineMgr) PauseBackgroundRefreshes(pause bool)
type ContextMgr ¶ added in v0.39.0
type ContextMgr struct { ContextStack []types.Context sync.RWMutex // contains filtered or unexported fields }
func NewContextMgr ¶ added in v0.39.0
func NewContextMgr( gui *Gui, allContexts *context.ContextTree, ) *ContextMgr
func (*ContextMgr) ActivateContext ¶ added in v0.39.0
func (self *ContextMgr) ActivateContext(c types.Context, opts types.OnFocusOpts) error
func (*ContextMgr) AllFilterable ¶ added in v0.39.0
func (self *ContextMgr) AllFilterable() []types.IFilterableContext
func (*ContextMgr) AllList ¶ added in v0.39.0
func (self *ContextMgr) AllList() []types.IListContext
all list contexts
func (*ContextMgr) AllPatchExplorer ¶ added in v0.39.0
func (self *ContextMgr) AllPatchExplorer() []types.IPatchExplorerContext
func (*ContextMgr) AllSearchable ¶ added in v0.39.0
func (self *ContextMgr) AllSearchable() []types.ISearchableContext
func (*ContextMgr) Current ¶ added in v0.39.0
func (self *ContextMgr) Current() types.Context
func (*ContextMgr) CurrentSide ¶ added in v0.39.0
func (self *ContextMgr) CurrentSide() types.Context
Note that this could return the 'status' context which is not itself a list context.
func (*ContextMgr) CurrentStatic ¶ added in v0.39.0
func (self *ContextMgr) CurrentStatic() types.Context
static as opposed to popup
func (*ContextMgr) ForEach ¶ added in v0.39.0
func (self *ContextMgr) ForEach(f func(types.Context))
func (*ContextMgr) IsCurrent ¶ added in v0.39.0
func (self *ContextMgr) IsCurrent(c types.Context) bool
func (*ContextMgr) Pop ¶ added in v0.39.0
func (self *ContextMgr) Pop() error
func (*ContextMgr) Push ¶ added in v0.39.0
func (self *ContextMgr) Push(c types.Context, opts ...types.OnFocusOpts) error
func (*ContextMgr) RemoveContexts ¶ added in v0.39.0
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 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 // flag as to whether or not the diff view should ignore whitespace IgnoreWhitespaceInDiffView 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 NewDummyGui ¶ added in v0.30.1
func NewDummyGui() *Gui
func NewGui ¶
func NewGui( cmn *common.Common, config config.AppConfigurer, gitVersion *git_commands.GitVersion, updater *updates.Updater, showRecentRepos bool, initialDir string, ) (*Gui, error)
for now the split view will always be on NewGui builds a new gui handler
func (*Gui) Contexts ¶ added in v0.22.0
func (gui *Gui) Contexts() *context.ContextTree
func (*Gui) GetCheatsheetKeybindings ¶ added in v0.35.0
only to be called from the cheatsheet generate script. This mutates the Gui struct.
func (*Gui) GetInitialKeybindings ¶ added in v0.7.1
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 ¶ added in v0.39.0
func (self *Gui) GetInitialKeybindingsWithCustomCommands() ([]*types.Binding, []*gocui.ViewMouseBinding)
func (*Gui) LogAction ¶ added in v0.35.0
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 ¶ added in v0.35.0
func (*Gui) RefreshMainView ¶ added in v0.36.0
func (*Gui) RunAndHandleError ¶ added in v0.27.1
func (*Gui) SetKeybinding ¶ added in v0.35.0
func (*Gui) SetMouseKeybinding ¶ added in v0.35.0
func (gui *Gui) SetMouseKeybinding(binding *gocui.ViewMouseBinding) error
warning: mutates the binding
func (*Gui) WatchFilesForChanges ¶ added in v0.39.0
func (gui *Gui) WatchFilesForChanges()
NOTE: given that we often edit files ourselves, this may make us end up refreshing files too often TODO: consider watching the whole directory recursively (could be more expensive)
type GuiDriver ¶ added in v0.36.0
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) CheckedOutRef ¶ added in v0.36.0
func (*GuiDriver) ContextForView ¶ added in v0.38.0
func (*GuiDriver) CurrentContext ¶ added in v0.36.0
func (*GuiDriver) Keys ¶ added in v0.36.0
func (self *GuiDriver) Keys() config.KeybindingConfig
func (*GuiDriver) Log ¶ added in v0.36.0
logs to the normal place that you log to i.e. viewable with `lazygit --logs`
func (*GuiDriver) SecondaryView ¶ added in v0.36.0
type GuiRepoState ¶ added in v0.35.0
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 ¶ added in v0.39.0
func (self *GuiRepoState) GetCurrentPopupOpts() *types.CreatePopupPanelOpts
func (*GuiRepoState) GetScreenMode ¶ added in v0.39.0
func (self *GuiRepoState) GetScreenMode() types.WindowMaximisation
func (*GuiRepoState) GetSearchState ¶ added in v0.39.0
func (self *GuiRepoState) GetSearchState() *types.SearchState
func (*GuiRepoState) GetSplitMainPanel ¶ added in v0.39.0
func (self *GuiRepoState) GetSplitMainPanel() bool
func (*GuiRepoState) GetStartupStage ¶ added in v0.39.0
func (self *GuiRepoState) GetStartupStage() types.StartupStage
func (*GuiRepoState) GetViewsSetup ¶ added in v0.39.0
func (self *GuiRepoState) GetViewsSetup() bool
func (*GuiRepoState) GetWindowViewNameMap ¶ added in v0.39.0
func (self *GuiRepoState) GetWindowViewNameMap() *utils.ThreadSafeMap[string, string]
func (*GuiRepoState) InSearchPrompt ¶ added in v0.39.0
func (self *GuiRepoState) InSearchPrompt() bool
func (*GuiRepoState) SetCurrentPopupOpts ¶ added in v0.39.0
func (self *GuiRepoState) SetCurrentPopupOpts(value *types.CreatePopupPanelOpts)
func (*GuiRepoState) SetScreenMode ¶ added in v0.39.0
func (self *GuiRepoState) SetScreenMode(value types.WindowMaximisation)
func (*GuiRepoState) SetSplitMainPanel ¶ added in v0.39.0
func (self *GuiRepoState) SetSplitMainPanel(value bool)
func (*GuiRepoState) SetStartupStage ¶ added in v0.39.0
func (self *GuiRepoState) SetStartupStage(value types.StartupStage)
type IntegrationTest ¶ added in v0.36.0
type IntegrationTest interface {
Run(*GuiDriver)
}
type OptionsMapMgr ¶ added in v0.39.0
type OptionsMapMgr struct {
// contains filtered or unexported fields
}
type PrevLayout ¶ added in v0.35.0
we keep track of some stuff from one render to the next to see if certain things have changed
type StateAccessor ¶ added in v0.39.0
type StateAccessor struct {
// contains filtered or unexported fields
}
func (*StateAccessor) GetIgnoreWhitespaceInDiffView ¶ added in v0.39.0
func (self *StateAccessor) GetIgnoreWhitespaceInDiffView() bool
func (*StateAccessor) GetIsRefreshingFiles ¶ added in v0.39.0
func (self *StateAccessor) GetIsRefreshingFiles() bool
func (*StateAccessor) GetRepoPathStack ¶ added in v0.39.0
func (self *StateAccessor) GetRepoPathStack() *utils.StringStack
func (*StateAccessor) GetRepoState ¶ added in v0.39.0
func (self *StateAccessor) GetRepoState() types.IRepoStateAccessor
func (*StateAccessor) GetRetainOriginalDir ¶ added in v0.39.0
func (self *StateAccessor) GetRetainOriginalDir() bool
func (*StateAccessor) GetShowExtrasWindow ¶ added in v0.39.0
func (self *StateAccessor) GetShowExtrasWindow() bool
func (*StateAccessor) GetUpdating ¶ added in v0.39.0
func (self *StateAccessor) GetUpdating() bool
func (*StateAccessor) SetIgnoreWhitespaceInDiffView ¶ added in v0.39.0
func (self *StateAccessor) SetIgnoreWhitespaceInDiffView(value bool)
func (*StateAccessor) SetIsRefreshingFiles ¶ added in v0.39.0
func (self *StateAccessor) SetIsRefreshingFiles(value bool)
func (*StateAccessor) SetRetainOriginalDir ¶ added in v0.39.0
func (self *StateAccessor) SetRetainOriginalDir(value bool)
func (*StateAccessor) SetShowExtrasWindow ¶ added in v0.39.0
func (self *StateAccessor) SetShowExtrasWindow(value bool)
func (*StateAccessor) SetUpdating ¶ added in v0.39.0
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
- file_watching.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