Documentation
¶
Index ¶
- type Binding
- type CheckoutRefOptions
- type ConfirmOpts
- type Context
- type ContextCommon
- type ContextKey
- type ContextKind
- type CreateMenuOptions
- type CreatePopupPanelOpts
- type DiffableContext
- type DisabledReason
- type ErrKeybindingNotHandled
- 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 IPatchExplorerContext
- type IPopupHandler
- type IRepoStateAccessor
- type ISearchHistoryContext
- type ISearchableContext
- type IStateAccessor
- type IViewTrait
- type ItemOperation
- type Key
- type KeybindingGuards
- type KeybindingsFn
- type KeybindingsOpts
- type ListItem
- type MainContextPair
- 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 PromptOpts
- type RefRange
- type RefreshMainOpts
- type RefreshMode
- type RefreshOptions
- type RefreshableView
- type RenderStringTask
- type RenderStringWithScrollTask
- type RenderStringWithoutScrollTask
- type RunCommandTask
- type RunPtyTask
- type ScreenMode
- type SearchState
- type SearchType
- type StartupStage
- type Suggestion
- type ToastKind
- type UpdateTask
- type VersionNumber
- type ViewUpdateOpts
- type Views
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Binding ¶ added in v0.35.0
type Binding struct {
ViewName string
Handler func() error
Key Key
Modifier gocui.Modifier
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
// 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) IsDisabled ¶ added in v0.41.0
type CheckoutRefOptions ¶ added in v0.35.0
type ConfirmOpts ¶ added in v0.35.0
type Context ¶ added in v0.35.0
type Context interface {
IBaseContext
HandleFocus(opts OnFocusOpts)
HandleFocusLost(opts OnFocusLostOpts)
FocusLine()
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
ColumnAlignment []utils.Alignment
AllowFilteringKeybindings bool
KeepConfirmKeybindings bool // if true, the keybindings that match the confirm binding will not be removed from menu items
}
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
}
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 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
GetOnClick() func() error
GetOnClickFocusedMainView() func(mainViewName string, clickedLineIdx int) error
}
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
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
// 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 onclick function so that
// our list controller can come along and wrap it in a list-specific click handler.
// We'll need to think of a better way to do this.
AddOnClickFn(func() error)
// Likewise for the focused main view: we need this to communicate between a
// side panel controller and the focused main view controller.
AddOnClickFocusedMainViewFn(func(mainViewName string, clickedLineIdx int) error)
AddOnRenderToMainFn(func())
AddOnFocusFn(func(OnFocusOpts))
AddOnFocusLostFn(func(OnFocusLostOpts))
}
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
IsCurrent(c Context) bool
IsCurrentOrParent(c Context) bool
ForEach(func(Context))
AllList() []IListContext
AllFilterable() []IFilterableContext
AllSearchable() []ISearchableContext
AllPatchExplorer() []IPatchExplorerContext
}
type IController ¶ added in v0.35.0
type IController interface {
HasKeybindings
Context() Context
GetOnRenderToMain() func()
GetOnFocus() func(OnFocusOpts)
GetOnFocusLost() func(OnFocusLostOpts)
}
type IFilterableContext ¶ added in v0.39.0
type IFilterableContext interface {
Context
IListPanelState
ISearchHistoryContext
SetFilter(string, bool)
GetFilter() string
ClearFilter()
ReApplyFilter(bool)
IsFiltering() bool
IsFilterableContext()
FilterPrefix(tr *i18n.TranslationSet) string
}
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)
// 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'
PostRefreshUpdate(Context)
// 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
// returns true if command completed successfully
RunSubprocess(cmdObj *oscommands.CmdObj) (bool, error)
RunSubprocessAndRefresh(*oscommands.CmdObj) error
Suspend() error
Resume() error
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)
// 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)
// 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() error
// 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
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 IPatchExplorerContext ¶ added in v0.36.0
type IPatchExplorerContext interface {
Context
GetState() *patch_exploring.State
SetState(*patch_exploring.State)
GetIncludedLineIndices() []int
RenderAndFocus()
Render()
GetContentToRender() string
GetMutex() *deadlock.Mutex
IsPatchExplorerContext() // used for type switch
}
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
WithWaitingStatusSync(message string, f func() 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
SetSplitMainPanel(bool)
GetSplitMainPanel() 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
}
type IStateAccessor ¶ added in v0.39.0
type IStateAccessor interface {
GetRepoPathStack() *utils.StringStack
GetRepoState() IRepoStateAccessor
GetPagerConfig() *config.PagerConfig
// tells us whether we're currently updating lazygit
GetUpdating() bool
SetUpdating(bool)
SetIsRefreshingFiles(bool)
GetIsRefreshingFiles() bool
GetShowExtrasWindow() bool
SetShowExtrasWindow(bool)
GetRetainOriginalDir() bool
SetRetainOriginalDir(bool)
GetItemOperation(item HasUrn) ItemOperation
SetItemOperation(item HasUrn, operation ItemOperation)
ClearItemOperation(item HasUrn)
}
type IViewTrait ¶ added in v0.35.0
type IViewTrait interface {
FocusPoint(yIdx int)
SetRangeSelectStart(yIdx int)
CancelRangeSelect()
SetViewPortContent(content string)
SetViewPortContentAndClearEverythingElse(content string)
SetContentLineCount(lineCount int)
SetContent(content string)
SetOriginX(value int)
ViewPortYBounds() (int, int)
ScrollLeft()
ScrollRight()
ScrollUp(value int)
ScrollDown(value int)
PageDelta() int
SelectedLineIdx() int
SetHighlight(bool)
}
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 {
GetKey func(key string) 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 MainViewPairs ¶ added in v0.36.0
type MainViewPairs struct {
Normal MainContextPair
MergeConflicts MainContextPair
Staging MainContextPair
PatchBuilding 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
OnPress func() error
// Only applies when Label is used
OpensMenu bool
// If Key is defined it allows the user to press the key to invoke the menu
// item, as opposed to having to navigate to it
Key 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
// 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
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
// for displaying suggestions while typing in a file name
FilesTrie *patricia.Trie
Authors map[string]*models.Author
HashPool *utils.StringPool
}
type Modes ¶ added in v0.35.0
type Modes struct {
Filtering filtering.Filtering
CherryPicking *cherrypicking.CherryPicking
Diffing diffing.Diffing
MarkedBaseCommit marked_base_commit.MarkedBaseCommit
}
type MouseKeybindingsFn ¶ added in v0.35.0
type MouseKeybindingsFn func(opts KeybindingsOpts) []*gocui.ViewMouseBinding
type Mutexes ¶ added in v0.36.0
type Mutexes struct {
RefreshingFilesMutex deadlock.Mutex
RefreshingBranchesMutex deadlock.Mutex
RefreshingStatusMutex deadlock.Mutex
LocalCommitsMutex deadlock.Mutex
SubCommitsMutex deadlock.Mutex
AuthorsMutex deadlock.Mutex
SubprocessMutex deadlock.Mutex
PopupMutex deadlock.Mutex
PtyMutex deadlock.Mutex
}
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 ParentContexter ¶ added in v0.35.0
type PromptOpts ¶ added in v0.35.0
type RefreshMainOpts ¶ added in v0.36.0
type RefreshMainOpts struct {
Pair MainContextPair
Main *ViewUpdateOpts
Secondary *ViewUpdateOpts
}
type RefreshMode ¶ added in v0.35.0
type RefreshMode int
const ( SYNC RefreshMode = iota // wait until everything is done before returning ASYNC // return immediately, allowing each independent thing to update itself BLOCK_UI // wrap code in an update call to ensure UI updates all at once and keybindings aren't executed till complete )
type RefreshOptions ¶ added in v0.35.0
type RefreshOptions struct {
Then func()
Scope []RefreshableView // e.g. []RefreshableView{COMMITS, BRANCHES}. Leave empty to refresh everything
Mode RefreshMode // one of SYNC (default), ASYNC, and BLOCK_UI
// Normally a refresh of the branches tries to keep the same branch selected
// (by name); this is usually important in case the order of branches
// changes. Passing true for KeepBranchSelectionIndex suppresses this and
// keeps the selection index the same. Useful after checking out a detached
// head, and selecting index 0.
KeepBranchSelectionIndex 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 STAGING PATCH_BUILDING MERGE_CONFLICTS COMMIT_FILES // not actually a view. Will refactor this later BISECT_INFO )
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 RunCommandTask ¶ added in v0.36.0
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 string) *RunCommandTask
func (*RunCommandTask) IsUpdateTask ¶ added in v0.36.0
func (t *RunCommandTask) IsUpdateTask()
type RunPtyTask ¶ added in v0.36.0
func NewRunPtyTask ¶ added in v0.36.0
func NewRunPtyTask(cmd *exec.Cmd) *RunPtyTask
func NewRunPtyTaskWithPrefix ¶ added in v0.53.0
func NewRunPtyTaskWithPrefix(cmd *exec.Cmd, prefix string) *RunPtyTask
func (*RunPtyTask) IsUpdateTask ¶ added in v0.36.0
func (t *RunPtyTask) 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()
}
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
}
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
Staging *gocui.View
StagingSecondary *gocui.View
PatchBuilding *gocui.View
PatchBuildingSecondary *gocui.View
MergeConflicts *gocui.View
Options *gocui.View
Confirmation *gocui.View
Prompt *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
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
}