Documentation
¶
Index ¶
- func ContentIsDiff(task UpdateTask) bool
- type Binding
- type BranchSelectionBehavior
- type CheckoutRefOptions
- type CommitSelectionBehavior
- type ConfirmOpts
- type Context
- type ContextCommon
- type ContextKey
- type ContextKind
- type CreateMenuOptions
- type CreatePopupPanelOpts
- type DiffLineInfo
- type DiffLineType
- type DiffMainViewContext
- type DiffMainViewType
- type DiffPaneContext
- type DiffSelectMode
- type DiffSelectState
- type DiffableContext
- type DisabledReason
- type ErrKeybindingNotHandled
- type FocusedMainViewActions
- type FocusedMainViewDiffSource
- type Guard
- type HasKeybindings
- type HasUrn
- type HelperCommon
- type IBaseContext
- type IContextMgr
- type IController
- type IFilterableContext
- type IGuiCommon
- type IList
- type IListContext
- type IListCursor
- type IListPanelState
- type IModeMgr
- type IPopupHandler
- type IRepoStateAccessor
- type ISearchHistoryContext
- type ISearchableContext
- type IStateAccessor
- type IViewTrait
- type ItemOperation
- type KeybindingGuards
- type KeybindingsFn
- type KeybindingsOpts
- type ListItem
- type MainContextPair
- type MainPanes
- type MainViewPairs
- type MenuItem
- type MenuSection
- type MenuWidget
- type Model
- type Modes
- type MouseKeybindingsFn
- type Mutexes
- type NeedsRerenderOnWidthChangeLevel
- type OnFocusLostOpts
- type OnFocusOpts
- type ParentContexter
- type Prefix
- type PromptOpts
- type PullRequestDiff
- type PullRequestDiffContext
- type RefRange
- type RefreshMainOpts
- type RefreshOptions
- type RefreshableView
- type RenderStringTask
- type RenderStringWithScrollTask
- type RenderStringWithoutScrollTask
- type RepoLocation
- type RunCommandTask
- type RunDiffRendererTask
- type ScreenMode
- type SearchState
- type SearchType
- type StartupStage
- type Suggestion
- type ToastKind
- type UpdateTask
- type VersionNumber
- type ViewUpdateOpts
- type Views
- type WaitingStatusOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContentIsDiff ¶ added in v0.66.0
func ContentIsDiff(task UpdateTask) bool
ContentIsDiff reports whether the given render fills a main pane with the diff a panel offers there, as opposed to a message, a commit log, or a diff that is part of an explanation. A selection means the lines of the panel's diff, so it is only over such a render that there is anything to point at.
Types ¶
type Binding ¶ added in v0.35.0
type Binding struct {
ViewName string
Handler func() error
Keys []gocui.Key
Description string
// DescriptionFunc is used instead of Description if non-nil, and is useful for dynamic
// descriptions that change depending on context. Important: this must not be an expensive call.
// Note that you should still provide a generic, non-dynamic description in the Description field,
// as this is used in the cheatsheet.
DescriptionFunc func() string
// If defined, this is used in place of Description when showing the keybinding
// in the options view at the bottom left of the screen.
ShortDescription string
// ShortDescriptionFunc is used instead of ShortDescription if non-nil, and is useful for dynamic
// descriptions that change depending on context. Important: this must not be an expensive call.
ShortDescriptionFunc func() string
Alternative string
Tag string // e.g. 'navigation'. Used for grouping things in the cheatsheet
OpensMenu bool
// If true, the keybinding will appear at the bottom of the screen.
// Even if set to true, the keybinding will not be displayed if it is currently
// disabled. We could instead display it with a strikethrough, but there's
// limited realestate to show all the keybindings we want, so we're hiding it instead.
DisplayOnScreen bool
// if unset, the binding will be displayed in the default color. Only applies to the keybinding
// on-screen, not in the keybindings menu.
DisplayStyle *style.TextStyle
// to be displayed if the keybinding is highlighted from within a menu
Tooltip string
// TooltipFunc is used instead of Tooltip if non-nil, for a command whose tooltip
// depends on context, as DescriptionFunc is for its description — and with the
// same two conditions: it must not be an expensive call, and a generic Tooltip
// must still be given, since that is the one the cheatsheet prints.
TooltipFunc func() string
// Function to decide whether the command is enabled, and why. If this
// returns an empty string, it is; if it returns a non-empty string, it is
// disabled and we show the given text in an error message when trying to
// invoke it. When left nil, the command is always enabled. Note that this
// function must not do expensive calls.
GetDisabledReason func() *DisabledReason
}
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 ""
func (*Binding) GetDescription ¶ added in v0.54.0
func (*Binding) GetShortDescription ¶ added in v0.54.0
func (*Binding) GetTooltip ¶ added in v0.66.0
func (*Binding) IsDisabled ¶ added in v0.41.0
type BranchSelectionBehavior ¶ added in v0.64.0
type BranchSelectionBehavior int
BranchSelectionBehavior controls which local branch is selected after the branches list is reloaded by a refresh.
const ( // Keep the same branch selected by name, restoring it at its new position if // the order changed. This is the right default whenever the list reloads // underneath a selection the user hasn't deliberately changed. KeepBranchSelectionByName BranchSelectionBehavior = iota // Select the checked-out branch (the one at the top of the list). Used after // operations that check something out - checkout, creating a branch, moving // commits to a new branch - so the newly checked-out ref ends up selected. SelectCheckedOutBranch )
type CheckoutRefOptions ¶ added in v0.35.0
type CheckoutRefOptions struct {
WaitingStatus string
EnvVars []string
OnRefNotFound func(ref string) error
// Refreshing pull requests is necessary when checking out a branch that doesn't exist locally
// (e.g. checking out a remote branch), but it not needed when checking out an existing local
// branch or a detached head (e.g. a tag).
RefreshPullRequests bool
}
type CommitSelectionBehavior ¶ added in v0.63.0
type CommitSelectionBehavior int
CommitSelectionBehavior controls which local commit is selected after the commits list is reloaded by a refresh.
const ( // Keep the same commit selected by hash (and the same range, when // range-selecting), restoring it at its new position if it moved. This is // the right default whenever the list reloads underneath a selection the // user hasn't deliberately changed. KeepCommitSelectionByHash CommitSelectionBehavior = iota // Leave the selection index untouched, because the caller set it itself // before refreshing. Used when jumping to the top of the list after a // checkout, and when following a commit that was just moved up or down. KeepCommitSelectionIndex // Select the HEAD commit. Used by operations that create a new commit at // HEAD (committing, merging, pulling with a merge); the by-hash behavior // can't restore a commit that didn't exist before the refresh. SelectHeadCommit )
type ConfirmOpts ¶ added in v0.35.0
type Context ¶ added in v0.35.0
type Context interface {
IBaseContext
HandleFocus(opts OnFocusOpts)
HandleFocusLost(opts OnFocusLostOpts)
HandleQuit()
FocusLine(scrollIntoView bool)
HandleRender()
HandleRenderToMain()
}
type ContextCommon ¶ added in v0.39.0
type ContextCommon struct {
*common.Common
IGuiCommon
}
type ContextKey ¶ added in v0.35.0
type ContextKey string
type ContextKind ¶ added in v0.35.0
type ContextKind int
const ( // this is your files, branches, commits, contexts etc. They're all on the left hand side // and you can cycle through them. SIDE_CONTEXT ContextKind = iota // This is either the left or right 'main' contexts that appear to the right of the side contexts MAIN_CONTEXT // A persistent popup is one that has its own identity e.g. the commit message context. // When you open a popup over it, we'll let you return to it upon pressing escape PERSISTENT_POPUP // A temporary popup is one that could be used for various things (e.g. a generic menu or confirmation popup). // Because we reuse these contexts, they're temporary in that you can't return to them after you've switched from them // to some other context, because the context you switched to might actually be the same context but rendering different content. // We should really be able to spawn new contexts for menus/prompts so that we can actually return to old ones. TEMPORARY_POPUP // This contains the command log, underneath the main contexts. EXTRAS_CONTEXT // only used by the one global context, purely for the sake of defining keybindings globally GLOBAL_CONTEXT // a display context only renders a view. It has no keybindings associated and // it cannot receive focus. DISPLAY_CONTEXT )
type CreateMenuOptions ¶ added in v0.35.0
type CreateMenuOptions struct {
Title string
Prompt string // a message that will be displayed above the menu options
Items []*MenuItem
HideCancel bool
OnCancel func() error // called when the menu is dismissed without selecting an item
ColumnAlignment []utils.Alignment
AllowFilteringKeybindings bool
KeepConflictingKeybindings bool // if true, the keybindings that match essential bindings such as confirm or return will not be removed from menu items
// if true, the menu has a filter row of its own and filters its items as the
// user types, instead of being filtered through the search prompt. Only for
// menus whose items don't have keybindings of their own, because those keys
// would clash with typing.
FilterAsYouType bool
}
type CreatePopupPanelOpts ¶ added in v0.35.0
type CreatePopupPanelOpts struct {
HasLoader bool
Editable bool
Title string
Prompt string
HandleConfirm func() error
HandleConfirmPrompt func(string) error
HandleClose func() error
HandleDeleteSuggestion func(int) error
FindSuggestionsFunc func(string) []*Suggestion
Mask bool
AllowEditSuggestion bool
AllowEmptyInput bool
PreserveWhitespace bool
}
type DiffLineInfo ¶ added in v0.66.0
type DiffLineInfo struct {
// Path is the absolute path of the file the line belongs to.
Path string
Type DiffLineType
// NewLine is the line's position in the new version of the file. Set for all
// content lines (for a deletion it is the position the deletion sits at) and
// for hunk headers (the first line of the hunk they head).
NewLine int
// OldLine is the line's position in the old version of the file. Set only
// for deletions, which are the only rows that need it: two consecutive
// deletions share a new-file position and differ only here.
OldLine int
}
DiffLineInfo is the identity of a row of a rendered diff in terms of the patch it was rendered from: which file the row belongs to, what kind of row it is, and where the line sits in the old and new versions of that file. This lets us act on the line the user is pointing at in a diff view: stage it, open it in an editor, keep the cursor on it across a re-render. The rendered text alone tells us none of that.
func (DiffLineInfo) IsChange ¶ added in v0.66.0
func (self DiffLineInfo) IsChange() bool
IsChange reports whether the row is an added or deleted line, as opposed to a context line or a header. It mirrors patch.PatchLine.IsChange: those are the rows a patch is built from, and the rows navigation moves between.
func (DiffLineInfo) IsContent ¶ added in v0.66.0
func (self DiffLineInfo) IsContent() bool
IsContent reports whether the row is a line of the file itself — a change or a context line — as opposed to a header or a marker. Those are the rows that have a position in the file, and so can be looked for in another rendering of the same diff, or in the diff itself.
func (DiffLineInfo) PatchLineIdentity ¶ added in v0.66.0
func (self DiffLineInfo) PatchLineIdentity() patch.LineIdentity
PatchLineIdentity says which change line of the file the row is, in the terms a patch of that file is built and read in: an addition by where it sits in the new version of the file, a deletion by where it sat in the old one. Only meaningful for a change row.
type DiffLineType ¶ added in v0.66.0
type DiffLineType int
DiffLineType classifies a row of a rendered diff.
const ( DiffLineFileHeader DiffLineType = iota DiffLineHunkHeader DiffLineContext DiffLineAdded DiffLineDeleted // DiffLineOther is anything that isn't one of the above, e.g. the // "\ No newline at end of file" marker. DiffLineOther )
type DiffMainViewContext ¶ added in v0.66.0
type DiffMainViewContext interface {
Context
GetDiffMainViewType() DiffMainViewType
}
DiffMainViewContext is implemented by the side panel contexts whose focused main view shows a unified diff — files, local commits, sub-commits, reflog, stash, and commit files — as opposed to a commit log or other non-diff content (branches, tags, status, …). It is distinct from DiffableContext, which is about producing a diff between two refs for the diff menu. The focused main view shows a selection only for a context that implements this: a selection is only meaningful where there are diff lines to act on (edit one, copy some, jump by hunk or file). The returned type additionally classifies what acting on that selection means.
type DiffMainViewType ¶ added in v0.66.0
type DiffMainViewType int
DiffMainViewType classifies what the focused main view's diff belongs to, which decides what acting on a selection in it means.
const ( // DiffMainViewTypeNone: the main view holds no diff, so there is nothing to // select. A side panel that doesn't implement DiffMainViewContext counts as // this; no panel returns it itself. DiffMainViewTypeNone DiffMainViewType = iota // DiffMainViewTypeStaging: the diff is the working tree's, so the selection can // be staged or unstaged (the files panel). DiffMainViewTypeStaging // DiffMainViewTypePatchBuilding: the diff belongs to a commit, so the selection // can be taken into a custom patch (the commit files / commits / sub-commits / // reflog / stash panels). DiffMainViewTypePatchBuilding )
type DiffPaneContext ¶ added in v0.66.0
type DiffPaneContext interface {
Context
DiffSelectState() *DiffSelectState
}
DiffPaneContext is one of the two panes the main section can show, as the thing that holds a diff with a selection in it. The panels that act on such a selection are handed the pane it was made in, and speak to it through this.
type DiffSelectMode ¶ added in v0.66.0
type DiffSelectMode int
DiffSelectMode is how the focused main view's diff selection extends from the cursor: a single line, a range from a fixed anchor, or the change block (hunk) around the cursor.
const ( DiffSelectModeLine DiffSelectMode = iota DiffSelectModeRange DiffSelectModeHunk )
type DiffSelectState ¶ added in v0.66.0
type DiffSelectState struct {
Mode DiffSelectMode
// When a range is sticky, moving the cursor without holding shift extends the
// range; otherwise it collapses the range back to a single line.
RangeIsSticky bool
// Whether hunk mode was turned on by the user rather than being the configured
// default. This decides whether escape leaves hunk mode or leaves the view.
UserEnabledHunkMode bool
}
DiffSelectState holds the *mode* of the focused main view's diff selection. The selected line and the range anchor themselves live in the gocui view (its cursor and range-select start), so only the mode lives here. It's on the context rather than on the controller because the controller that drives the selection, the controller that establishes it on focus, and the pane-toggle that seeds it on the other pane all reach the pane through its context.
type DiffableContext ¶ added in v0.39.0
type DiffableContext interface {
Context
// Returns the current diff terminals of the currently selected item.
// in the case of a branch it returns both the branch and it's upstream name,
// which becomes an option when you bring up the diff menu, but when you're just
// flicking through branches it will be using the local branch name.
GetDiffTerminals() []string
// Returns the ref that should be used for creating a diff of what's
// currently shown in the main view against the working directory, in order
// to adjust line numbers in the diff to match the current state of the
// shown file. For example, if the main view shows a range diff of commits,
// we need to pass the first commit of the range. This is used by
// DiffHelper.AdjustLineNumber.
RefForAdjustingLineNumberInDiff() string
}
type DisabledReason ¶ added in v0.41.0
type DisabledReason struct {
Text string
// When trying to invoke a disabled key binding or menu item, we normally
// show the disabled reason as a toast; setting this to true shows it as an
// error panel instead. This is useful if the text is very long, or if it is
// important enough to show it more prominently, or both.
ShowErrorInPanel bool
// If true, the keybinding dispatch mechanism will continue to look for
// other handlers for the keypress.
AllowFurtherDispatching bool
}
type ErrKeybindingNotHandled ¶ added in v0.52.0
type ErrKeybindingNotHandled struct {
DisabledReason *DisabledReason
}
func (ErrKeybindingNotHandled) Error ¶ added in v0.52.0
func (e ErrKeybindingNotHandled) Error() string
func (ErrKeybindingNotHandled) Unwrap ¶ added in v0.52.0
func (e ErrKeybindingNotHandled) Unwrap() error
type FocusedMainViewActions ¶ added in v0.66.0
type FocusedMainViewActions interface {
FocusedMainViewDiffSource
// PrimaryAction acts on the diff lines in the inclusive buffer-line range that the
// current selection in the given pane covers (see View.SelectedBufferLineRange): a
// single line, a range, or a hunk. The panel re-renders the diff itself, being the
// one that knows what it did to it.
PrimaryAction(pane DiffPaneContext, firstBufferLine int, lastBufferLine int) error
// DiscardSelection takes the selected diff lines back out of whatever they are part
// of: the working tree for the files panel, the commit itself for the panels showing
// a commit's diff.
DiscardSelection(pane DiffPaneContext, firstBufferLine int, lastBufferLine int) error
// DiscardSelectionDisabledReason says why the selection can't be discarded where it
// is, and nil when it can. Taking lines out of a commit means rewriting it, which
// isn't always something we may do; the working tree has no such condition.
DiscardSelectionDisabledReason(pane DiffPaneContext) *DisabledReason
// PatchInclusion says which lines of the diff this panel shows are in the custom
// patch being built from it. The marks over those lines are drawn from this. nil
// where nothing about this diff is being built into a patch, which is always so
// for a diff that can't be.
PatchInclusion() func(info DiffLineInfo) bool
}
FocusedMainViewActions describes what a side panel does when the user acts on a selection of diff lines in the focused main view. The main view owns the selection and the keys; what acting on it means is the panel's business, e.g. the working tree panel stages and unstages.
It extends the diff source rather than standing beside it, because acting on a selection needs the diff behind the rendering just as reading it does; a panel that implements only the source offers a diff to read and copy but nothing to do to it.
type FocusedMainViewDiffSource ¶ added in v0.66.0
type FocusedMainViewDiffSource interface {
PlainDiff(pane DiffPaneContext, paths []string) string
}
FocusedMainViewDiffSource is how a side panel hands out the diff behind what it renders into the focused main view: the diff of the given files as git writes it, with no colour and no diff renderer in the way. What the main view shows is that same diff after a renderer has had it, which may have restructured, reordered or dropped parts of it — so anything that needs the diff itself, rather than a picture of it, asks the panel that produced it.
paths are repo-relative, and are asked for rather than assumed so that a few lines of a commit's diff can be had without fetching the whole thing. pane says which of the two main panes is asking, since a panel can show a different diff in each — the files panel shows the unstaged changes in one and the staged ones in the other.
type Guard ¶ added in v0.35.0
A guard is a decorator which checks something before executing a handler and potentially early-exits if some precondition hasn't been met.
type HasKeybindings ¶ added in v0.35.0
type HasKeybindings interface {
GetKeybindings(opts KeybindingsOpts) []*Binding
GetMouseKeybindings(opts KeybindingsOpts) []*gocui.ViewMouseBinding
// Implement this to get called when there's a double-click on the view. Only supported by list
// views currently. Will be called after the double-clicked list entry has been selected.
GetOnDoubleClick() func() error
// Implement this to get called for any non-double-click in the view. Only supported by list
// views currently. Will be called after the clicked list entry has been selected, and
// HandleFocus has already been called (so the main view is up to date). Should return nil if it
// decides not to do anything with the click.
GetOnClick() func(opts gocui.ViewMouseBindingOpts) error
// Implement this in a side-panel controller to hand out the diff behind what your
// panel renders into the focused main view, for the commands that act on a
// selection in it. nil for a controller whose panel shows no diff.
GetFocusedMainViewDiffSource() FocusedMainViewDiffSource
}
type HelperCommon ¶ added in v0.35.0
type HelperCommon struct {
*ContextCommon
}
type IBaseContext ¶ added in v0.35.0
type IBaseContext interface {
HasKeybindings
ParentContexter
GetKind() ContextKind
GetViewName() string
// The view that keyboard input goes to while this context is focused. That is
// the context's own view, unless the context has an editable view embedded in
// it which takes the keyboard instead, like the menu's filter input.
GetInputViewName() string
GetView() *gocui.View
GetViewTrait() IViewTrait
GetWindowName() string
SetWindowName(string)
GetKey() ContextKey
IsFocusable() bool
// if a context is transient, then it only appears via some keybinding on another
// context. Until we add support for having multiple of the same context, no two
// of the same transient context can appear at once meaning one might be 'stolen'
// from another window.
IsTransient() bool
// this tells us if the view's bounds are determined by its window or if they're
// determined independently.
HasControlledBounds() bool
// true if the context holds something for a selection to sit on. Contexts that
// don't show a selection at all say false, and so do lists with nothing in them.
HasSelectableContent() bool
SetHasSelectableContent(bool)
// the total height of the content that the view is currently showing
TotalContentHeight() int
// to what extent the view needs to be rerendered when its width changes
NeedsRerenderOnWidthChange() NeedsRerenderOnWidthChangeLevel
// true if the view needs to be rerendered when its height changes
NeedsRerenderOnHeightChange() bool
// returns the desired title for the view upon activation. If there is no desired title (returns empty string), then
// no title will be set
Title() string
GetOptionsMap() map[string]string
AddKeybindingsFn(KeybindingsFn)
AddMouseKeybindingsFn(MouseKeybindingsFn)
ClearAllAttachedControllerFunctions()
// This is a bit of a hack at the moment: we currently only set an onDoubleClick function so
// that the generic ListController can be specialized by view-specific controllers.
// We'll need to think of a better way to do this.
AddOnDoubleClickFn(func() error)
// Adding on to the above, this is so that a list-specific handler can register
// a hook for doing additional click handling
AddOnClickFn(func(opts gocui.ViewMouseBindingOpts) error)
// Likewise for the focused main view, which acts on the diff of whichever panel
// is beneath it and so has to reach that panel's controller. nil for a panel
// that shows no diff.
AddFocusedMainViewDiffSource(FocusedMainViewDiffSource)
AddOnRenderToMainFn(func())
AddOnFocusFn(func(OnFocusOpts))
AddOnFocusLostFn(func(OnFocusLostOpts))
AddOnQuitFn(func())
}
type IContextMgr ¶ added in v0.39.0
type IContextMgr interface {
Push(context Context, opts OnFocusOpts)
Pop()
Replace(context Context)
Activate(context Context, opts OnFocusOpts)
Current() Context
CurrentStatic() Context
CurrentSide() Context
CurrentPopup() []Context
NextInStack(context Context) Context
IsInStack(context Context) bool
UpdateSelectionHighlights()
IsCurrent(c Context) bool
IsCurrentOrParent(c Context) bool
ForEach(func(Context))
AllList() []IListContext
AllFilterable() []IFilterableContext
AllSearchable() []ISearchableContext
}
type IController ¶ added in v0.35.0
type IController interface {
HasKeybindings
Context() Context
GetOnRenderToMain() func()
GetOnFocus() func(OnFocusOpts)
GetOnFocusLost() func(OnFocusLostOpts)
// Implement this to get called when the app quits, and the controller's context has the focus.
// Useful for saving state on quit.
GetOnQuit() func()
}
type IFilterableContext ¶ added in v0.39.0
type IFilterableContext interface {
Context
IListPanelState
ISearchHistoryContext
SetFilter(string, bool)
GetFilter() string
ClearFilter()
ReApplyFilter(bool)
IsFiltering() bool
IsFilterableContext()
}
type IGuiCommon ¶ added in v0.35.0
type IGuiCommon interface {
IPopupHandler
LogAction(action string)
LogCommand(cmdStr string, isCommandLine bool)
// we call this when we want to refetch some models and render the result. Internally calls PostRefreshUpdate
Refresh(RefreshOptions)
// Like Refresh, but withholds keyboard input until the refreshed state is
// in place: keys pressed while the refresh is in flight are buffered and
// replayed once its model and view updates have run, instead of being
// handled against the stale, pre-refresh state. Use it when the very next
// keypress may depend on what the refresh produces — e.g. staging a hunk,
// where the refresh moves the selection to the next stageable hunk that
// the next press is meant to stage. Keep it to quick, narrow-scoped
// refreshes: one that includes COMMITS (or refreshes everything) can take
// very long in large repos and should usually not block input unless
// there's a very good reason (switching repos is one such example).
RefreshBlockingInput(RefreshOptions)
// Like Refresh, but for callers running on a worker goroutine (e.g. inside
// a WithWaitingStatus handler) rather than the UI thread. The refresh
// captures the model/context state it needs on the UI thread before doing
// its git work; knowing which thread the caller is on lets it capture
// inline (UI thread) or hop across (worker) without racing or deadlocking.
RefreshFromWorker(RefreshOptions)
// we call this when we've changed something in the view model but not the actual model,
// e.g. expanding or collapsing a folder in a file view. Calling 'Refresh' in this
// case would be overkill, although refresh will internally call 'PostRefreshUpdate'.
// It re-focuses the context's selection, which scrolls it into view.
PostRefreshUpdate(Context)
// Like PostRefreshUpdate, with control over scrolling and whether to update
// the main view.
PostRefreshUpdateWithOptions(Context, OnFocusOpts)
// renders string to a view without resetting its origin
SetViewContent(view *gocui.View, content string)
// resets cursor and origin of view. Often used before calling SetViewContent
ResetViewOrigin(view *gocui.View)
// this just re-renders the screen
Render()
// allows rendering to main views (i.e. the ones to the right of the side panel)
// in such a way that avoids concurrency issues when there are slow commands
// to display the output of
RenderToMainViews(opts RefreshMainOpts)
// used purely for the sake of RenderToMainViews to provide the pair of main views we want to render to
MainViewPairs() MainViewPairs
// return the view buffer manager for the given view, or nil if it doesn't have one
GetViewBufferManagerForView(view *gocui.View) *tasks.ViewBufferManager
// return the view buffer manager for the given view, making one if the view has
// never rendered anything, for saying something about a render still to come
GetOrCreateViewBufferManagerForView(view *gocui.View) *tasks.ViewBufferManager
// read enough lines into the given view's buffer to fill it at its current
// scroll position, plus some read-ahead for smooth scrolling
ReadLinesToFillView(view *gocui.View)
// returns true if command completed successfully
RunSubprocess(cmdObj *oscommands.CmdObj) (bool, error)
RunSubprocessAndRefresh(*oscommands.CmdObj) error
Suspend() error
Resume() error
// Pause or resume the background routines. Calls nest, so every pause must be balanced
// by a resume.
PauseBackgroundRefreshes(pause bool)
Context() IContextMgr
ContextForKey(key ContextKey) Context
GetConfig() config.AppConfigurer
GetAppState() *config.AppState
SaveAppState() error
SaveAppStateAndLogError()
// Runs the given function on the UI thread (this is for things like showing a popup asking a user for input).
// Only necessary to call if you're not already on the UI thread i.e. you're inside a goroutine.
// All controller handlers are executed on the UI thread.
OnUIThread(f func() error)
// Like OnUIThread, but for work triggered by a background routine, so it
// doesn't count towards lazygit being busy (see the *Background methods on
// gocui.Gui and repo-switch safety).
OnUIThreadBackground(f func() error)
// Like OnUIThread, but signals that the callback only modifies view
// content (e.g. spinner), allows the event loop to skip
// the expensive layout recalculation when only content changed.
OnUIThreadContentOnly(f func() error)
// Like OnUIThreadContentOnly, but for background work (see OnUIThreadBackground).
OnUIThreadContentOnlyBackground(f func() error)
// Runs a function in a goroutine. Use this whenever you want to run a goroutine and keep track of the fact
// that lazygit is still busy. See docs/dev/Busy.md
OnWorker(f func(gocui.Task) error)
// Like OnWorker, but for a background routine (or work it triggers), so it
// doesn't count towards lazygit being busy (see OnUIThreadBackground).
OnWorkerBackground(f func(gocui.Task) error)
// Function to call at the end of our 'layout' function which renders views
// For example, you may want a view's line to be focused only after that view is
// resized, if in accordion mode.
AfterLayout(f func() error)
// Wraps a function, attaching the given operation to the given item while
// the function is executing, and also causes the given context to be
// redrawn periodically. This allows the operation to be visualized with a
// spinning loader animation (e.g. when a branch is being pushed).
WithInlineStatus(item HasUrn, operation ItemOperation, contextKey ContextKey, f func(gocui.Task) error) error
// returns the gocui Gui struct. There is a good chance you don't actually want to use
// this struct and instead want to use another method above
GocuiGui() *gocui.Gui
Views() Views
Git() *commands.GitCommand
OS() *oscommands.OSCommand
Model() *Model
Modes() *Modes
Mutexes() *Mutexes
State() IStateAccessor
KeybindingsOpts() KeybindingsOpts
CallKeybindingHandler(binding *Binding) error
ResetKeybindings()
// hopefully we can remove this once we've moved all our keybinding stuff out of the gui god struct.
GetInitialKeybindingsWithCustomCommands() ([]*Binding, []*gocui.ViewMouseBinding)
// Returns true if we're running an integration test
RunningIntegrationTest() bool
// Returns true if we're in a demo recording/playback
InDemo() bool
}
type IList ¶ added in v0.35.0
type IList interface {
IListCursor
Len() int
GetItem(index int) HasUrn
}
type IListContext ¶ added in v0.35.0
type IListContext interface {
Context
GetSelectedItemId() string
GetSelectedItemIds() ([]string, int, int)
IsItemVisible(item HasUrn) bool
GetList() IList
ViewIndexToModelIndex(int) int
ModelIndexToViewIndex(int) int
IsListContext() // used for type switch
RangeSelectEnabled() bool
RenderOnlyVisibleLines() bool
SetNeedRerenderVisibleLines()
IndexForGotoBottom() int
}
type IListCursor ¶ added in v0.35.0
type IListCursor interface {
GetSelectedLineIdx() int
SetSelectedLineIdx(value int)
SetSelection(value int)
MoveSelectedLine(delta int)
ClampSelection()
CancelRangeSelect()
GetRangeStartIdx() (int, bool)
GetSelectionRange() (int, int)
IsSelectingRange() bool
AreMultipleItemsSelected() bool
ToggleStickyRange()
ExpandNonStickyRange(int)
}
type IListPanelState ¶ added in v0.35.0
type IPopupHandler ¶ added in v0.35.0
type IPopupHandler interface {
// The global error handler for gocui. Not to be used by application code.
ErrorHandler(err error) error
// Shows a notification popup with the given title and message to the user.
//
// This is a convenience wrapper around Confirm(), thus the popup can be closed using both 'Enter' and 'ESC'.
Alert(title string, message string)
// Shows a popup asking the user for confirmation.
Confirm(opts ConfirmOpts)
// Shows a popup asking the user for confirmation if condition is true; otherwise, the HandleConfirm function is called directly.
ConfirmIf(condition bool, opts ConfirmOpts) error
// Shows a popup prompting the user for input.
Prompt(opts PromptOpts)
WithWaitingStatus(message string, f func(gocui.Task) error) error
WithWaitingStatusBlockingInput(opts WaitingStatusOpts, f func(gocui.Task) error) error
Menu(opts CreateMenuOptions) error
Toast(message string)
ErrorToast(message string)
SetToastFunc(func(string, ToastKind))
GetPromptInput() string
}
type IRepoStateAccessor ¶ added in v0.39.0
type IRepoStateAccessor interface {
GetViewsSetup() bool
GetWindowViewNameMap() *utils.ThreadSafeMap[string, string]
GetStartupStage() StartupStage
SetStartupStage(stage StartupStage)
GetCurrentPopupOpts() *CreatePopupPanelOpts
SetCurrentPopupOpts(*CreatePopupPanelOpts)
GetScreenMode() ScreenMode
SetScreenMode(ScreenMode)
InSearchPrompt() bool
GetSearchState() *SearchState
SetMainPanes(MainPanes)
GetMainPanes() MainPanes
GetMergeOrRebaseStartedInLazygit() bool
SetMergeOrRebaseStartedInLazygit(bool)
}
type ISearchHistoryContext ¶ added in v0.41.0
type ISearchHistoryContext interface {
Context
GetSearchHistory() *utils.HistoryBuffer[string]
}
type ISearchableContext ¶ added in v0.39.0
type ISearchableContext interface {
Context
ISearchHistoryContext
// These are all implemented by SearchTrait
SetSearchString(string)
GetSearchString() string
ClearSearchString()
IsSearching() bool
IsSearchableContext()
RenderSearchStatus(int, int)
// This must be implemented by each concrete context. Return nil if not searching the model.
ModelSearchResults(searchStr string, caseSensitive bool) []gocui.SearchPosition
OnSearchSelect(selectedLineIdx int)
}
type IStateAccessor ¶ added in v0.39.0
type IStateAccessor interface {
GetRepoPathStack() *utils.Stack[RepoLocation]
GetRepoState() IRepoStateAccessor
GetDiffRendererConfigManager() *config.DiffRendererConfigManager
// tells us whether we're currently updating lazygit
GetUpdating() bool
SetUpdating(bool)
GetShowExtrasWindow() bool
SetShowExtrasWindow(bool)
GetRetainOriginalDir() bool
SetRetainOriginalDir(bool)
GetItemOperation(item HasUrn) ItemOperation
SetItemOperation(item HasUrn, operation ItemOperation)
ClearItemOperation(item HasUrn)
// A counter that is bumped every time we switch to a different repository
// (see Gui.resetState). A refresh captures it when it starts and carries it
// through to onUIThreadUnlessRepoChanged, so that a model update computed for
// one repo can be dropped rather than applied to another if the user switched
// repos while the refresh was in flight.
GetRepoGeneration() int
}
type IViewTrait ¶ added in v0.35.0
type IViewTrait interface {
FocusPoint(yIdx int, scrollIntoView bool)
SetRangeSelectStart(yIdx int)
CancelRangeSelect()
SetViewPortContent(content string)
SetViewPortContentAndClearEverythingElse(lineCount int, content string)
SetContent(content string)
SetOriginX(value int)
ViewPortYBounds() (int, int)
ScrollLeft()
ScrollRight()
ScrollUp(value int)
ScrollDown(value int)
PageDelta() int
SelectedLineIdx() int
}
type ItemOperation ¶ added in v0.41.0
type ItemOperation int
A long-running operation associated with an item. For example, we'll show that a branch is being pushed from so that there's visual feedback about what's happening and so that you can see multiple branches' concurrent operations
const ( ItemOperationNone ItemOperation = iota ItemOperationPushing ItemOperationPulling ItemOperationFastForwarding ItemOperationDeleting ItemOperationFetching ItemOperationCheckingOut )
type KeybindingGuards ¶ added in v0.35.0
type KeybindingsFn ¶ added in v0.35.0
type KeybindingsFn func(opts KeybindingsOpts) []*Binding
type KeybindingsOpts ¶ added in v0.35.0
type KeybindingsOpts struct {
GetKeys func(keys config.Keybinding) []gocui.Key
Config config.KeybindingConfig
Guards KeybindingGuards
}
type ListItem ¶ added in v0.35.0
type ListItem interface {
// ID is a hash when the item is a commit, a filename when the item is a file, 'stash@{4}' when it's a stash entry, 'my_branch' when it's a branch
ID() string
// Description is something we would show in a message e.g. '123as14: push blah' for a commit
Description() string
}
type MainContextPair ¶ added in v0.36.0
func NewMainContextPair ¶ added in v0.36.0
func NewMainContextPair(main Context, secondary Context) MainContextPair
type MainPanes ¶ added in v0.66.0
type MainPanes int
MainPanes says which of the two panes of the main section are shown. Most content takes the main pane alone; content with two sides to it — the working tree's unstaged and staged changes, a commit's diff and the patch built from it — takes both; and content whose only side is the second one takes the secondary pane alone, so that it has the whole section rather than sitting under an empty pane.
type MainViewPairs ¶ added in v0.36.0
type MainViewPairs struct {
Normal MainContextPair
MergeConflicts MainContextPair
}
type MenuItem ¶ added in v0.35.0
type MenuItem struct {
Label string
// alternative to Label. Allows specifying columns which will be auto-aligned
LabelColumns []string
// The strings that filtering the menu matches against, for menus that
// abbreviate their columns to keep them narrow. If nil, LabelColumns are
// matched, so that a menu only needs to set this if what it displays is not
// the full text.
FilterColumns []string
OnPress func() error
// Only applies when Label is used
OpensMenu bool
// If Keys is non-empty, the user can press any of these keys to invoke the
// menu item, as opposed to having to navigate to it. Only the first key is
// shown in the menu; the alternates are matched silently.
Keys []gocui.Key
// A widget to show in front of the menu item. Supported widget types are
// checkboxes and radio buttons,
// This only handles the rendering of the widget; the behavior needs to be
// provided by the client.
Widget MenuWidget
// The tooltip will be displayed upon highlighting the menu item
Tooltip string
// If non-nil, show this in a tooltip, style the menu item as disabled,
// and refuse to invoke the command
DisabledReason *DisabledReason
// Can be used to group menu items into sections with headers. MenuItems
// with the same Section should be contiguous, and will automatically get a
// section header. If nil, the item is not part of a section.
// Note that pointer comparison is used to determine whether two menu items
// belong to the same section, so make sure all your items in a given
// section point to the same MenuSection instance.
Section *MenuSection
}
type MenuSection ¶ added in v0.41.0
type MenuWidget ¶ added in v0.43.0
type MenuWidget int
const ( MenuWidgetNone MenuWidget = iota MenuWidgetRadioButtonSelected MenuWidgetRadioButtonUnselected MenuWidgetCheckboxSelected MenuWidgetCheckboxUnselected )
func MakeMenuCheckBox ¶ added in v0.43.0
func MakeMenuCheckBox(value bool) MenuWidget
func MakeMenuRadioButton ¶ added in v0.43.0
func MakeMenuRadioButton(value bool) MenuWidget
type Model ¶ added in v0.35.0
type Model struct {
CommitFiles []*models.CommitFile
Files []*models.File
Submodules []*models.SubmoduleConfig
Branches []*models.Branch
Commits []*models.Commit
StashEntries []*models.StashEntry
SubCommits []*models.Commit
Remotes []*models.Remote
Worktrees []*models.Worktree
PullRequests []*models.GithubPullRequest
PullRequestsMap map[string]*models.GithubPullRequest
// FilteredReflogCommits are the ones that appear in the reflog panel.
// When in filtering mode we only include the ones that match the given path
FilteredReflogCommits []*models.Commit
// ReflogCommits are the ones used by the branches panel to obtain recency values,
// and for the undo functionality.
// If we're not in filtering mode, CommitFiles and FilteredReflogCommits will be
// one and the same
ReflogCommits []*models.Commit
BisectInfo *git_commands.BisectInfo
WorkingTreeStateAtLastCommitRefresh models.WorkingTreeState
CommitsWereFilteredAtLastRefresh bool
RemoteBranches []*models.RemoteBranch
Tags []*models.Tag
// Name of the currently checked out branch. This will be set even when
// we're on a detached head because we're rebasing or bisecting.
CheckedOutBranch string
MainBranches *git_commands.MainBranches
Authors map[string]*models.Author
HashPool *utils.StringPool
}
type Modes ¶ added in v0.35.0
type Modes struct {
Filtering filtering.Filtering
CherryPicking *cherrypicking.CherryPicking // shared by all repo states; see Gui.cherryPicking
Diffing diffing.Diffing
MarkedBaseCommit marked_base_commit.MarkedBaseCommit
}
type MouseKeybindingsFn ¶ added in v0.35.0
type MouseKeybindingsFn func(opts KeybindingsOpts) []*gocui.ViewMouseBinding
type NeedsRerenderOnWidthChangeLevel ¶ added in v0.43.0
type NeedsRerenderOnWidthChangeLevel int
const ( // view doesn't render differently when its width changes NEEDS_RERENDER_ON_WIDTH_CHANGE_NONE NeedsRerenderOnWidthChangeLevel = iota // view renders differently when its width changes. An example is a view // that truncates long lines to the view width, e.g. the branches view NEEDS_RERENDER_ON_WIDTH_CHANGE_WHEN_WIDTH_CHANGES // view renders differently only when the screen mode changes NEEDS_RERENDER_ON_WIDTH_CHANGE_WHEN_SCREEN_MODE_CHANGES )
type OnFocusLostOpts ¶ added in v0.36.0
type OnFocusLostOpts struct {
NewContextKey ContextKey
}
type OnFocusOpts ¶ added in v0.35.0
type OnFocusOpts struct {
ClickedWindowName string
ClickedViewLineIdx int
// Focusing a list context scrolls its selection into view. Set this to leave
// the view's scroll position alone instead; only for callers that maintain
// it themselves, e.g. by keeping the selection at the edge of the viewport.
KeepScrollPosition bool
// Set this when the focused item hasn't changed and the main view's current
// content is still valid.
SkipMainViewUpdate bool
}
type ParentContexter ¶ added in v0.35.0
type Prefix ¶ added in v0.66.0
A Prefix produces what a render of a command shows above the command's output.
It is called with the width the render is laid out to, on the UI thread once the layout has settled that width, and returns the function that produces the text. That function is called on the render's own goroutine before the command starts, so a prefix that takes a while to produce holds up only the render and not the UI. Whatever it needs from the UI thread, it reads in the outer function.
func PrefixForWidth ¶ added in v0.66.0
PrefixForWidth is a prefix that is quick to lay out, so that it is produced in full on the UI thread.
func StaticPrefix ¶ added in v0.66.0
StaticPrefix is a prefix that is the same at any width.
type PromptOpts ¶ added in v0.35.0
type PromptOpts struct {
Title string
InitialContent string
FindSuggestionsFunc func(string) []*Suggestion
HandleConfirm func(string) error
AllowEditSuggestion bool
AllowEmptyInput bool
PreserveWhitespace bool
// CAPTURE THIS
HandleClose func() error
HandleDeleteSuggestion func(int) error
Mask bool
}
type PullRequestDiff ¶ added in v0.66.0
type PullRequestDiff struct {
// Branch is the local branch whose pull request would show the diff, and "" where
// no branch's would: the panel may have nothing selected, HEAD may be detached, or
// what was drilled into may be a tag or a remote branch rather than a local one.
// In a stack of branches, each with a pull request of its own, it is the branch
// of the stack that the newest of the commits is on.
Branch string
// SpansBranches is true where the commits are on more than one branch of such a
// stack. Branch is then the branch of the newest of them, and its pull request
// doesn't hold all of them.
SpansBranches bool
// Commits are the commits whose combined diff the main view is showing, newest
// first as the panel lists them.
Commits []*models.Commit
// BaseHash is the hash of the commit the diff starts after: the parent of the
// oldest of the commits, where the pull request has that parent as one of its own
// commits, and "" where the diff starts where the pull request itself does.
BaseHash string
}
PullRequestDiff is the diff of one or more commits of a branch, as the pull request for that branch shows it.
type PullRequestDiffContext ¶ added in v0.66.0
type PullRequestDiffContext interface {
Context
// PullRequestDiff returns the commits whose combined diff the main view is
// showing, and the branch whose pull request would show that diff.
PullRequestDiff() PullRequestDiff
}
PullRequestDiffContext is implemented by the side panel contexts that show, in their focused main view, the diff of a commit of a branch: the commits panel and the sub-commits panel, and the commit files panel entered from either of them. A pull request for that branch has a view of that commit, so a line of the diff can be pointed at in it. A panel showing a diff that no pull request has a view of (the working tree's, a stash entry's, a reflog entry's) doesn't implement this.
type RefreshMainOpts ¶ added in v0.36.0
type RefreshMainOpts struct {
Pair MainContextPair
Main *ViewUpdateOpts
Secondary *ViewUpdateOpts
}
type RefreshOptions ¶ added in v0.35.0
type RefreshOptions struct {
Then func() error
Scope []RefreshableView // e.g. []RefreshableView{COMMITS, BRANCHES}. Leave empty to refresh everything
// If true, hold off on updating the UI until all scopes have finished
// refreshing and then apply them together in a single frame, rather than
// letting each scope update the UI as soon as it's done.
BatchUIUpdates bool
// Set this when the refresh doesn't invalidate the main view's current
// content, so refreshing the side context needn't render it again.
SkipMainViewUpdate bool
// Controls which local branch is selected after the refresh. Defaults to
// KeepBranchSelectionByName.
BranchSelection BranchSelectionBehavior
// Controls which local commit is selected after the refresh. Defaults to
// KeepCommitSelectionByHash.
CommitSelection CommitSelectionBehavior
// When true, select the top (most recent) reflog entry after the refresh.
// Used alongside SelectCheckedOutBranch by operations that check something
// out, since the checkout adds a new reflog entry at the top. Defaults to
// keeping the reflog selection where it is.
SelectTopReflogCommit bool
// When true, this refresh was initiated by a background routine rather than
// by a user action. Every git command suppresses optional locks by default
// so it can't contend for index.lock (see git_commands.OptionalLocksEnvVar);
// a foreground files refresh (this false) is the one command that opts back
// in, so it persists git's refreshed stat-cache and keeps later status calls
// fast. Background refreshes leave the suppression in place: not persisting
// the stat-cache is the right trade-off for unattended work.
Background bool
// When true, this foreground refresh does not block switching repos while
// it is in flight. A refresh is switch-safe by construction — its git
// commands run against the repo it was started for, and the generation
// guard drops its model/view updates if the repo changed — but a refresh
// triggered by a user operation still blocks switching (its tasks count
// towards Busy()), because the operation's follow-up work isn't covered
// by those guards. A refresh that merely reloads state (on focus, after a
// repo switch, after returning from a subprocess) has no such follow-up,
// so it opts in here and a repo switch during it is allowed rather than
// refused with a toast.
//
// Must not be combined with Then: Then is not generation-guarded, so it
// would run against the newly switched-to repo.
DontBlockRepoSwitch bool
}
type RefreshableView ¶ added in v0.35.0
type RefreshableView int
models/views that we can refresh
const ( COMMITS RefreshableView = iota REBASE_COMMITS SUB_COMMITS BRANCHES FILES STASH REFLOG TAGS REMOTES WORKTREES STATUS SUBMODULES MERGE_CONFLICTS COMMIT_FILES // not actually views. Will refactor this later BISECT_INFO PULL_REQUESTS )
type RenderStringTask ¶ added in v0.36.0
type RenderStringTask struct {
Str string
}
func NewRenderStringTask ¶ added in v0.36.0
func NewRenderStringTask(str string) *RenderStringTask
func (*RenderStringTask) IsUpdateTask ¶ added in v0.36.0
func (t *RenderStringTask) IsUpdateTask()
type RenderStringWithScrollTask ¶ added in v0.36.0
func NewRenderStringWithScrollTask ¶ added in v0.36.0
func NewRenderStringWithScrollTask(str string, originX int, originY int) *RenderStringWithScrollTask
func (*RenderStringWithScrollTask) IsUpdateTask ¶ added in v0.36.0
func (t *RenderStringWithScrollTask) IsUpdateTask()
type RenderStringWithoutScrollTask ¶ added in v0.36.0
type RenderStringWithoutScrollTask struct {
Str string
}
func NewRenderStringWithoutScrollTask ¶ added in v0.36.0
func NewRenderStringWithoutScrollTask(str string) *RenderStringWithoutScrollTask
func (*RenderStringWithoutScrollTask) IsUpdateTask ¶ added in v0.36.0
func (t *RenderStringWithoutScrollTask) IsUpdateTask()
type RepoLocation ¶ added in v0.64.1
RepoLocation is everything it takes to open a repo again: the directory to change to, plus the environment telling git where the repo is for the repos git can't find from that directory (see RepoPaths.GitLocationEnvVars), which is empty for all the others.
type RunCommandTask ¶ added in v0.36.0
type RunCommandTask struct {
Cmd *exec.Cmd
Prefix Prefix
// contains filtered or unexported fields
}
func NewRunCommandTask ¶ added in v0.36.0
func NewRunCommandTask(cmd *exec.Cmd) *RunCommandTask
func NewRunCommandTaskWithPrefix ¶ added in v0.36.0
func NewRunCommandTaskWithPrefix(cmd *exec.Cmd, prefix Prefix) *RunCommandTask
func (*RunCommandTask) IsUpdateTask ¶ added in v0.36.0
func (t *RunCommandTask) IsUpdateTask()
type RunDiffRendererTask ¶ added in v0.66.0
type RunDiffRendererTask struct {
Cmd *exec.Cmd
Prefix Prefix
// contains filtered or unexported fields
}
func NewRunDiffRendererTask ¶ added in v0.66.0
func NewRunDiffRendererTask(cmd *exec.Cmd) *RunDiffRendererTask
func NewRunDiffRendererTaskWithPrefix ¶ added in v0.66.0
func NewRunDiffRendererTaskWithPrefix(cmd *exec.Cmd, prefix Prefix) *RunDiffRendererTask
func (*RunDiffRendererTask) IsUpdateTask ¶ added in v0.66.0
func (t *RunDiffRendererTask) IsUpdateTask()
type ScreenMode ¶ added in v0.45.0
type ScreenMode 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 ScreenMode = iota SCREEN_HALF SCREEN_FULL )
type SearchState ¶ added in v0.39.0
TODO: could we remove this entirely?
func NewSearchState ¶ added in v0.39.0
func NewSearchState() *SearchState
func (*SearchState) SearchType ¶ added in v0.39.0
func (self *SearchState) SearchType() SearchType
type SearchType ¶ added in v0.39.0
type SearchType int
const ( SearchTypeNone SearchType = iota // searching is where matches are highlighted but the content is not filtered down SearchTypeSearch // filter is where the list is filtered down to only matches SearchTypeFilter )
type StartupStage ¶ added in v0.39.0
type StartupStage int
startup stages so we don't need to load everything at once
const ( INITIAL StartupStage = iota COMPLETE )
type Suggestion ¶
type Suggestion struct {
// value is the thing that we're matching on and the thing that will be submitted if you select the suggestion
Value string
// label is what is actually displayed so it can e.g. contain color
Label string
}
func (*Suggestion) ID ¶ added in v0.41.0
func (self *Suggestion) ID() string
Conforming to the HasID interface, which is needed for list contexts
type UpdateTask ¶ added in v0.36.0
type UpdateTask interface {
IsUpdateTask()
}
func NewMainViewDiffTask ¶ added in v0.66.0
func NewMainViewDiffTask(cmd *exec.Cmd, mode git_commands.DiffMode) UpdateTask
NewMainViewDiffTask returns the task for rendering a diff into a main view. A diff normally goes through the diff renderer, however the render arranges to feed it. A diff we are producing with git itself, because the renderer's version of it couldn't be acted on, has to keep the renderer out, so it runs as a plain command instead.
The task it returns is the one that says its output is a diff, so a pane rendering it can be pointed at (see ContentIsDiff).
func NewMainViewDiffTaskWithPrefix ¶ added in v0.66.0
func NewMainViewDiffTaskWithPrefix(cmd *exec.Cmd, prefix Prefix, mode git_commands.DiffMode) UpdateTask
type VersionNumber ¶ added in v0.41.0
type VersionNumber struct {
Major, Minor, Patch int
}
func ParseVersionNumber ¶ added in v0.41.0
func ParseVersionNumber(versionStr string) (*VersionNumber, error)
func (*VersionNumber) IsOlderThan ¶ added in v0.41.0
func (v *VersionNumber) IsOlderThan(otherVersion *VersionNumber) bool
type ViewUpdateOpts ¶ added in v0.36.0
type ViewUpdateOpts struct {
Title string
SubTitle string
Task UpdateTask
// NothingToActOn marks a pane that is being shown only because the layout is
// configured to always split the diff: its side of the file holds nothing, so it
// is not a pane to leave the focus in.
NothingToActOn bool
}
type Views ¶ added in v0.39.0
type Views struct {
Status *gocui.View
Submodules *gocui.View
Files *gocui.View
Branches *gocui.View
Remotes *gocui.View
Worktrees *gocui.View
Tags *gocui.View
RemoteBranches *gocui.View
ReflogCommits *gocui.View
Commits *gocui.View
Stash *gocui.View
Main *gocui.View
Secondary *gocui.View
MergeConflicts *gocui.View
Options *gocui.View
Confirmation *gocui.View
Prompt *gocui.View
Menu *gocui.View
MenuFilterFrame *gocui.View
MenuFilter *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
StatusSpacer1 *gocui.View
StatusSpacer2 *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 WaitingStatusOpts ¶ added in v0.64.1
type WaitingStatusOpts struct {
// The message shown alongside the spinner while the operation runs.
Message string
// When set, the working tree state mode (the yellow
// "Rebasing"/"Merging"/"Cherry-picking"/"Reverting" indicator, along with
// its abort button) stays hidden until the operation is done. Set it for
// operations that drive such a state themselves: the state they leave on
// disk while they run is transient, so surfacing it would flash the
// indicator on and offer to abort a sequence that lazygit is in the middle
// of running.
HideWorkingTreeState bool
}