Documentation ¶
Index ¶
- Constants
- Variables
- func Headless() bool
- func MergeMaps[K comparable, V any](maps ...map[K]V) map[K]V
- func NewDummyUpdater() *updates.Updater
- func NewFileWatcher(log *logrus.Entry) *fileWatcher
- func OnFocusWrapper(f func() error) func(opts types.OnFocusOpts) error
- type ContextManager
- type Gui
- func (self *Gui) GetCheatsheetKeybindings() []*types.Binding
- func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBinding)
- func (gui *Gui) LogAction(action string)
- func (gui *Gui) LogCommand(cmdStr string, commandLine bool)
- func (gui *Gui) Refresh(options types.RefreshOptions) error
- func (gui *Gui) RefreshMainView(opts *types.ViewUpdateOpts, context types.Context) error
- func (gui *Gui) RenderCommitLength()
- 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) SwitchToCommitFilesContext(opts controllers.SwitchToCommitFilesContextOpts) error
- func (gui *Gui) TransientContexts() []types.Context
- 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
- type IntegrationTest
- type PrevLayout
- type Repo
- type StartupStage
- type Views
- type WindowMaximisation
Constants ¶
const COMMIT_THRESHOLD = 200
after selecting the 200th commit, we'll load in all the rest
const HORIZONTAL_SCROLL_FACTOR = 3
const INFO_SECTION_PADDING = " "
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 SEARCH_PREFIX = "search: "
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 MergeMaps ¶ added in v0.35.0
func MergeMaps[K comparable, V any](maps ...map[K]V) map[K]V
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 ContextManager ¶ added in v0.27.1
func NewContextManager ¶ added in v0.27.1
func NewContextManager() ContextManager
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 Views // if we've suspended the gui (e.g. because we've switched to a subprocess) // we typically want to pause some things that are running like background // file refreshes PauseBackgroundThreads bool // Log of the commands that get run, to be displayed to the user. CmdLog []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 // 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 // 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) 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) 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) RenderCommitLength ¶ added in v0.2.2
func (gui *Gui) RenderCommitLength()
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) SwitchToCommitFilesContext ¶ added in v0.35.0
func (gui *Gui) SwitchToCommitFilesContext(opts controllers.SwitchToCommitFilesContextOpts) error
func (*Gui) TransientContexts ¶ added in v0.35.0
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 // Suggestions will sometimes appear when typing into a prompt Suggestions []*types.Suggestion Updating bool SplitMainPanel bool LimitCommits bool IsRefreshingFiles bool Searching searchingState StartupStage StartupStage // Allows us to not load everything at once ContextManager ContextManager 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 WindowMaximisation CurrentPopupOpts *types.CreatePopupPanelOpts }
type IntegrationTest ¶ added in v0.36.0
type IntegrationTest interface {
Run(guiAdapter *GuiDriver)
}
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 StartupStage ¶ added in v0.27.1
type StartupStage int
startup stages so we don't need to load everything at once
const ( INITIAL StartupStage = iota COMPLETE )
type Views ¶ added in v0.27.1
type Views struct { Status *gocui.View Submodules *gocui.View Files *gocui.View Branches *gocui.View Remotes *gocui.View Tags *gocui.View RemoteBranches *gocui.View ReflogCommits *gocui.View Commits *gocui.View Stash *gocui.View Main *gocui.View Secondary *gocui.View Staging *gocui.View StagingSecondary *gocui.View PatchBuilding *gocui.View PatchBuildingSecondary *gocui.View MergeConflicts *gocui.View Options *gocui.View Confirmation *gocui.View Menu *gocui.View CommitMessage *gocui.View CommitDescription *gocui.View CommitFiles *gocui.View SubCommits *gocui.View Information *gocui.View AppStatus *gocui.View Search *gocui.View SearchPrefix *gocui.View Limit *gocui.View Suggestions *gocui.View Tooltip *gocui.View Extras *gocui.View // for playing the easter egg snake game Snake *gocui.View }
type WindowMaximisation ¶ added in v0.27.1
type WindowMaximisation int
screen sizing determines how much space your selected window takes up (window as in panel, not your terminal's window). Sometimes you want a bit more space to see the contents of a panel, and this keeps track of how much maximisation you've set
const ( SCREEN_NORMAL WindowMaximisation = iota SCREEN_HALF SCREEN_FULL )
Source Files ¶
- app_status_manager.go
- arrangement.go
- background.go
- branches_panel.go
- command_log_panel.go
- commit_files_panel.go
- commit_message_panel.go
- commits_panel.go
- confirmation_panel.go
- context.go
- context_config.go
- controllers.go
- custom_patch_options_panel.go
- diffing.go
- dummies.go
- editors.go
- extras_panel.go
- file_watching.go
- files_panel.go
- filtering.go
- filtering_menu_panel.go
- global_handlers.go
- gui.go
- gui_common.go
- gui_driver.go
- information_panel.go
- keybindings.go
- layout.go
- list_context_config.go
- main_panels.go
- menu_panel.go
- modes.go
- options_menu_panel.go
- pty.go
- quitting.go
- recent_repos_panel.go
- reflog_panel.go
- refresh.go
- remote_branches_panel.go
- remotes_panel.go
- searching.go
- side_window.go
- snake.go
- stash_panel.go
- status_panel.go
- sub_commits_panel.go
- submodules_panel.go
- suggestions_panel.go
- tags_panel.go
- tasks_adapter.go
- test_mode.go
- updates.go
- view_helpers.go
- views.go
- whitespace-toggle.go
- window.go