Documentation
¶
Index ¶
- Constants
- Variables
- func MergeMaps[K comparable, V any](maps ...map[K]V) map[K]V
- func NewDummyUpdater() *updates.Updater
- func NewFileWatcher(log *logrus.Entry) *fileWatcher
- func NewRenderStringTask(str string) *renderStringTask
- func NewRenderStringWithoutScrollTask(str string) *renderStringWithoutScrollTask
- func NewRunCommandTask(cmd *exec.Cmd) *runCommandTask
- func NewRunCommandTaskWithPrefix(cmd *exec.Cmd, prefix string) *runCommandTask
- func NewRunPtyTask(cmd *exec.Cmd) *runPtyTask
- func OnFocusWrapper(f func() error) func(opts ...types.OnFocusOpts) error
- type ContextManager
- type Gui
- func (gui *Gui) CheckCanChangeContext() error
- func (gui *Gui) DecreaseContextInDiffView() error
- func (self *Gui) GetCheatsheetKeybindings() []*types.Binding
- func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBinding)
- func (gui *Gui) HandleOpenFile() error
- func (gui *Gui) IncreaseContextInDiffView() error
- func (gui *Gui) LogAction(action string)
- func (gui *Gui) LogCommand(cmdStr string, commandLine bool)
- func (gui *Gui) OnUIThread(f func() error)
- func (gui *Gui) Refresh(options types.RefreshOptions) error
- func (gui *Gui) RenderCommitLength()
- func (gui *Gui) Run(startArgs types.StartArgs) error
- func (gui *Gui) RunAndHandleError(startArgs types.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
- func (gui *Gui) ViewContextMapSet(viewName string, c types.Context)
- type GuiRepoState
- type LblPanelState
- type MergingPanelState
- 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
const UNKNOWN_VIEW_ERROR_MSG = "unknown view"
Variables ¶
var CONTEXT_KEYS_SHOWING_DIFFS = []types.ContextKey{ context.FILES_CONTEXT_KEY, context.COMMIT_FILES_CONTEXT_KEY, context.STASH_CONTEXT_KEY, context.LOCAL_COMMITS_CONTEXT_KEY, context.SUB_COMMITS_CONTEXT_KEY, context.MAIN_STAGING_CONTEXT_KEY, context.MAIN_PATCH_BUILDING_CONTEXT_KEY, }
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 NewRenderStringTask ¶ added in v0.27.1
func NewRenderStringTask(str string) *renderStringTask
func NewRenderStringWithoutScrollTask ¶ added in v0.27.1
func NewRenderStringWithoutScrollTask(str string) *renderStringWithoutScrollTask
func NewRunCommandTask ¶ added in v0.27.1
func NewRunCommandTaskWithPrefix ¶ added in v0.27.1
func NewRunPtyTask ¶ added in v0.27.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(initialContext types.Context) 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 guiMutexes // 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, gitConfig git_config.IGitConfig, 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) CheckCanChangeContext ¶ added in v0.32.1
func (*Gui) DecreaseContextInDiffView ¶ added in v0.32.1
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) HandleOpenFile ¶ added in v0.35.0
func (*Gui) IncreaseContextInDiffView ¶ added in v0.32.1
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) OnUIThread ¶ added in v0.32.2
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 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 Panels *panelStates SplitMainPanel bool LimitCommits bool IsRefreshingFiles bool Searching searchingState Ptmx *os.File StartupStage StartupStage // Allows us to not load everything at once MainContext types.ContextKey // used to keep the main and secondary views' contexts in sync ContextManager ContextManager Contexts *context.ContextTree ViewContextMap *context.ViewContextMap ViewTabContextMap map[string][]context.TabContext // 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 map[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 // contains filtered or unexported fields }
type LblPanelState ¶ added in v0.28.1
type LblPanelState struct { *lbl.State SecondaryFocused bool // this is for if we show the left or right panel }
for now the staging panel state, unlike the other panel states, is going to be non-mutative, so that we don't accidentally end up with mismatches of data. We might change this in the future
type MergingPanelState ¶ added in v0.28.1
type MergingPanelState struct { *mergeconflicts.State // UserVerticalScrolling tells us if the user has started scrolling through the file themselves // in which case we won't auto-scroll to a conflict. UserVerticalScrolling bool }
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 Files *gocui.View Branches *gocui.View RemoteBranches *gocui.View Commits *gocui.View Stash *gocui.View Main *gocui.View Secondary *gocui.View Options *gocui.View Confirmation *gocui.View Menu *gocui.View CommitMessage *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 }
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
- 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
- diff_context_size.go
- diffing.go
- dummies.go
- editors.go
- errors.go
- extras_panel.go
- file_watching.go
- files_panel.go
- filtering.go
- filtering_menu_panel.go
- global_handlers.go
- gui.go
- gui_common.go
- information_panel.go
- keybindings.go
- layout.go
- line_by_line_panel.go
- list_context_config.go
- main_panels.go
- menu_panel.go
- merge_panel.go
- modes.go
- options_menu_panel.go
- patch_building_panel.go
- patch_options_panel.go
- pty.go
- quitting.go
- recent_repos_panel.go
- recording.go
- reflog_panel.go
- refresh.go
- remote_branches_panel.go
- remotes_panel.go
- searching.go
- side_window.go
- staging_panel.go
- stash_panel.go
- status_panel.go
- sub_commits_panel.go
- submodules_panel.go
- suggestions_panel.go
- tags_panel.go
- tasks_adapter.go
- updates.go
- view_helpers.go
- views.go
- whitespace-toggle.go
- window.go