Documentation ¶
Index ¶
- Constants
- Variables
- func NewDisplayContext(key types.ContextKey, view *gocui.View, windowName string) types.Context
- func Zero[T any]() T
- type BaseContext
- func (self *BaseContext) AddKeybindingsFn(fn types.KeybindingsFn)
- func (self *BaseContext) AddMouseKeybindingsFn(fn types.MouseKeybindingsFn)
- func (self *BaseContext) AddOnClickFn(fn func() error)
- func (self *BaseContext) AddOnFocusFn(fn onFocusFn)
- func (self *BaseContext) AddOnFocusLostFn(fn onFocusLostFn)
- func (self *BaseContext) AddOnRenderToMainFn(fn func() error)
- func (self *BaseContext) GetKey() types.ContextKey
- func (self *BaseContext) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding
- func (self *BaseContext) GetKind() types.ContextKind
- func (self *BaseContext) GetMouseKeybindings(opts types.KeybindingsOpts) []*gocui.ViewMouseBinding
- func (self *BaseContext) GetOnClick() func() error
- func (self *BaseContext) GetOnFocus() onFocusFn
- func (self *BaseContext) GetOnFocusLost() onFocusLostFn
- func (self *BaseContext) GetOnRenderToMain() func() error
- func (self *BaseContext) GetOptionsMap() map[string]string
- func (self *BaseContext) GetView() *gocui.View
- func (self *BaseContext) GetViewName() string
- func (self *BaseContext) GetViewTrait() types.IViewTrait
- func (self *BaseContext) GetWindowName() string
- func (self *BaseContext) HasControlledBounds() bool
- func (self *BaseContext) IsFocusable() bool
- func (self *BaseContext) IsTransient() bool
- func (self *BaseContext) NeedsRerenderOnWidthChange() bool
- func (self *BaseContext) SetWindowName(windowName string)
- func (self *BaseContext) Title() string
- type BranchesContext
- type CommitFilesContext
- type CommitMessageContext
- func (self *CommitMessageContext) CanSwitchToEditor() bool
- func (self *CommitMessageContext) GetHistoryMessage() string
- func (self *CommitMessageContext) GetPreserveMessage() bool
- func (self *CommitMessageContext) GetPreservedMessage() string
- func (self *CommitMessageContext) GetSelectedIndex() int
- func (self *CommitMessageContext) OnConfirm(summary string, description string) error
- func (self *CommitMessageContext) RenderCommitLength()
- func (self *CommitMessageContext) SetHistoryMessage(message string)
- func (self *CommitMessageContext) SetPanelState(index int, summaryTitle string, descriptionTitle string, preserveMessage bool, ...)
- func (self *CommitMessageContext) SetPreservedMessage(message string)
- func (self *CommitMessageContext) SetSelectedIndex(value int)
- func (self *CommitMessageContext) SwitchToEditor(message string) error
- type CommitMessageViewModel
- type ConfirmationContext
- type ConfirmationContextState
- type ConflictsViewModel
- type ContextCommon
- type ContextTree
- type DynamicTitleBuilder
- type FilteredList
- func (self *FilteredList[T]) ClearFilter()
- func (self *FilteredList[T]) GetFilter() string
- func (self *FilteredList[T]) GetFilteredList() []T
- func (self *FilteredList[T]) IsFiltering() bool
- func (self *FilteredList[T]) ReApplyFilter()
- func (self *FilteredList[T]) SetFilter(filter string)
- func (self *FilteredList[T]) UnfilteredIndex(index int) int
- func (self *FilteredList[T]) UnfilteredLen() int
- type FilteredListViewModel
- type HasID
- type ListContextTrait
- func (self *ListContextTrait) FocusLine()
- func (self *ListContextTrait) HandleFocus(opts types.OnFocusOpts) error
- func (self *ListContextTrait) HandleFocusLost(opts types.OnFocusLostOpts) error
- func (self *ListContextTrait) HandleRender() error
- func (self *ListContextTrait) IsItemVisible(item types.HasUrn) bool
- func (self *ListContextTrait) IsListContext()
- func (self *ListContextTrait) OnSearchSelect(selectedLineIdx int) error
- func (self *ListContextTrait) RangeSelectEnabled() bool
- type ListRenderer
- type ListViewModel
- func (self *ListViewModel[T]) GetItem(index int) types.HasUrn
- func (self *ListViewModel[T]) GetItems() []T
- func (self *ListViewModel[T]) GetSelected() T
- func (self *ListViewModel[T]) GetSelectedItemId() string
- func (self *ListViewModel[T]) GetSelectedItemIds() ([]string, int, int)
- func (self *ListViewModel[T]) GetSelectedItems() ([]T, int, int)
- type LocalCommitsContext
- type LocalCommitsViewModel
- func (self *LocalCommitsViewModel) GetCommits() []*models.Commit
- func (self *LocalCommitsViewModel) GetLimitCommits() bool
- func (self *LocalCommitsViewModel) GetShowWholeGitGraph() bool
- func (self *LocalCommitsViewModel) SetLimitCommits(value bool)
- func (self *LocalCommitsViewModel) SetShowWholeGitGraph(value bool)
- type MenuContext
- type MenuViewModel
- type MergeConflictsContext
- func (self *MergeConflictsContext) FocusSelection()
- func (self *MergeConflictsContext) GetContentToRender() string
- func (self *MergeConflictsContext) GetMutex() *deadlock.Mutex
- func (self *MergeConflictsContext) GetOriginY() int
- func (self *MergeConflictsContext) GetState() *mergeconflicts.State
- func (self *MergeConflictsContext) IsUserScrolling() bool
- func (self *MergeConflictsContext) Render() error
- func (self *MergeConflictsContext) RenderAndFocus() error
- func (self *MergeConflictsContext) SetSelectedLineRange()
- func (self *MergeConflictsContext) SetState(state *mergeconflicts.State)
- func (self *MergeConflictsContext) SetUserScrolling(isScrolling bool)
- type NewBaseContextOpts
- type NonModelItem
- type ParentContextMgr
- type PatchExplorerContext
- func (self *PatchExplorerContext) Focus() error
- func (self *PatchExplorerContext) FocusSelection()
- func (self *PatchExplorerContext) GetContentToRender(isFocused bool) string
- func (self *PatchExplorerContext) GetIncludedLineIndices() []int
- func (self *PatchExplorerContext) GetMutex() *deadlock.Mutex
- func (self *PatchExplorerContext) GetState() *patch_exploring.State
- func (self *PatchExplorerContext) GetViewTrait() types.IViewTrait
- func (self *PatchExplorerContext) IsPatchExplorerContext()
- func (self *PatchExplorerContext) NavigateTo(isFocused bool, selectedLineIdx int) error
- func (self *PatchExplorerContext) Render(isFocused bool) error
- func (self *PatchExplorerContext) RenderAndFocus(isFocused bool) error
- func (self *PatchExplorerContext) SetState(state *patch_exploring.State)
- type ReflogCommitsContext
- func (self *ReflogCommitsContext) CanRebase() bool
- func (self *ReflogCommitsContext) GetCommits() []*models.Commit
- func (self *ReflogCommitsContext) GetDiffTerminals() []string
- func (self *ReflogCommitsContext) GetSelectedRef() types.Ref
- func (self *ReflogCommitsContext) ShowBranchHeadsInSubCommits() bool
- type RemoteBranchesContext
- type RemotesContext
- type SearchHistory
- type SearchTrait
- func (self *SearchTrait) ClearSearchString()
- func (self *SearchTrait) GetSearchString() string
- func (self *SearchTrait) IsSearchableContext()
- func (self *SearchTrait) IsSearching() bool
- func (self *SearchTrait) RenderSearchStatus(index int, total int)
- func (self *SearchTrait) SetSearchString(searchString string)
- type SimpleContext
- type StashContext
- type SubCommitsContext
- func (self *SubCommitsContext) CanRebase() bool
- func (self *SubCommitsContext) GetCommits() []*models.Commit
- func (self *SubCommitsContext) GetDiffTerminals() []string
- func (self *SubCommitsContext) GetLimitCommits() bool
- func (self *SubCommitsContext) GetSelectedRef() types.Ref
- func (self *SubCommitsContext) SetLimitCommits(value bool)
- type SubCommitsViewModel
- func (self *SubCommitsViewModel) GetRef() types.Ref
- func (self *SubCommitsViewModel) GetRefToShowDivergenceFrom() string
- func (self *SubCommitsViewModel) GetShowBranchHeads() bool
- func (self *SubCommitsViewModel) SetRef(ref types.Ref)
- func (self *SubCommitsViewModel) SetRefToShowDivergenceFrom(ref string)
- func (self *SubCommitsViewModel) SetShowBranchHeads(value bool)
- type SubmodulesContext
- type SuggestionsContext
- type SuggestionsContextState
- type TabView
- type TagsContext
- type ViewTrait
- func (self *ViewTrait) CancelRangeSelect()
- func (self *ViewTrait) FocusPoint(yIdx int)
- func (self *ViewTrait) PageDelta() int
- func (self *ViewTrait) ScrollDown(value int)
- func (self *ViewTrait) ScrollLeft()
- func (self *ViewTrait) ScrollRight()
- func (self *ViewTrait) ScrollUp(value int)
- func (self *ViewTrait) SelectedLineIdx() int
- func (self *ViewTrait) SetContent(content string)
- func (self *ViewTrait) SetFooter(value string)
- func (self *ViewTrait) SetHighlight(highlight bool)
- func (self *ViewTrait) SetOriginX(value int)
- func (self *ViewTrait) SetRangeSelectStart(yIdx int)
- func (self *ViewTrait) SetViewPortContent(content string)
- func (self *ViewTrait) ViewPortYBounds() (int, int)
- type WorkingTreeContext
- type WorktreesContext
Constants ¶
const ( // used as a nil value when passing a context key as an arg NO_CONTEXT types.ContextKey = "none" GLOBAL_CONTEXT_KEY types.ContextKey = "global" STATUS_CONTEXT_KEY types.ContextKey = "status" SNAKE_CONTEXT_KEY types.ContextKey = "snake" FILES_CONTEXT_KEY types.ContextKey = "files" LOCAL_BRANCHES_CONTEXT_KEY types.ContextKey = "localBranches" REMOTES_CONTEXT_KEY types.ContextKey = "remotes" WORKTREES_CONTEXT_KEY types.ContextKey = "worktrees" REMOTE_BRANCHES_CONTEXT_KEY types.ContextKey = "remoteBranches" TAGS_CONTEXT_KEY types.ContextKey = "tags" LOCAL_COMMITS_CONTEXT_KEY types.ContextKey = "commits" REFLOG_COMMITS_CONTEXT_KEY types.ContextKey = "reflogCommits" SUB_COMMITS_CONTEXT_KEY types.ContextKey = "subCommits" COMMIT_FILES_CONTEXT_KEY types.ContextKey = "commitFiles" STASH_CONTEXT_KEY types.ContextKey = "stash" NORMAL_MAIN_CONTEXT_KEY types.ContextKey = "normal" NORMAL_SECONDARY_CONTEXT_KEY types.ContextKey = "normalSecondary" STAGING_MAIN_CONTEXT_KEY types.ContextKey = "staging" STAGING_SECONDARY_CONTEXT_KEY types.ContextKey = "stagingSecondary" PATCH_BUILDING_MAIN_CONTEXT_KEY types.ContextKey = "patchBuilding" PATCH_BUILDING_SECONDARY_CONTEXT_KEY types.ContextKey = "patchBuildingSecondary" MERGE_CONFLICTS_CONTEXT_KEY types.ContextKey = "mergeConflicts" // these shouldn't really be needed for anything but I'm giving them unique keys nonetheless OPTIONS_CONTEXT_KEY types.ContextKey = "options" APP_STATUS_CONTEXT_KEY types.ContextKey = "appStatus" SEARCH_PREFIX_CONTEXT_KEY types.ContextKey = "searchPrefix" INFORMATION_CONTEXT_KEY types.ContextKey = "information" LIMIT_CONTEXT_KEY types.ContextKey = "limit" STATUS_SPACER1_CONTEXT_KEY types.ContextKey = "statusSpacer1" STATUS_SPACER2_CONTEXT_KEY types.ContextKey = "statusSpacer2" MENU_CONTEXT_KEY types.ContextKey = "menu" CONFIRMATION_CONTEXT_KEY types.ContextKey = "confirmation" SEARCH_CONTEXT_KEY types.ContextKey = "search" COMMIT_MESSAGE_CONTEXT_KEY types.ContextKey = "commitMessage" COMMIT_DESCRIPTION_CONTEXT_KEY types.ContextKey = "commitDescription" SUBMODULES_CONTEXT_KEY types.ContextKey = "submodules" SUGGESTIONS_CONTEXT_KEY types.ContextKey = "suggestions" COMMAND_LOG_CONTEXT_KEY types.ContextKey = "cmdLog" )
const HORIZONTAL_SCROLL_FACTOR = 3
const NoCommitIndex = -1
when selectedIndex (see below) is set to this value, it means that we're not currently viewing a commit message of an existing commit: instead we're making our own new commit message
Variables ¶
var AllContextKeys = []types.ContextKey{ GLOBAL_CONTEXT_KEY, STATUS_CONTEXT_KEY, FILES_CONTEXT_KEY, LOCAL_BRANCHES_CONTEXT_KEY, REMOTES_CONTEXT_KEY, WORKTREES_CONTEXT_KEY, REMOTE_BRANCHES_CONTEXT_KEY, TAGS_CONTEXT_KEY, LOCAL_COMMITS_CONTEXT_KEY, REFLOG_COMMITS_CONTEXT_KEY, SUB_COMMITS_CONTEXT_KEY, COMMIT_FILES_CONTEXT_KEY, STASH_CONTEXT_KEY, NORMAL_MAIN_CONTEXT_KEY, NORMAL_SECONDARY_CONTEXT_KEY, STAGING_MAIN_CONTEXT_KEY, STAGING_SECONDARY_CONTEXT_KEY, PATCH_BUILDING_MAIN_CONTEXT_KEY, PATCH_BUILDING_SECONDARY_CONTEXT_KEY, MERGE_CONFLICTS_CONTEXT_KEY, MENU_CONTEXT_KEY, CONFIRMATION_CONTEXT_KEY, SEARCH_CONTEXT_KEY, COMMIT_MESSAGE_CONTEXT_KEY, SUBMODULES_CONTEXT_KEY, SUGGESTIONS_CONTEXT_KEY, COMMAND_LOG_CONTEXT_KEY, }
Functions ¶
func NewDisplayContext ¶
A Display context only renders a view. It has no keybindings and is not focusable.
Types ¶
type BaseContext ¶
type BaseContext struct { *ParentContextMgr // contains filtered or unexported fields }
func NewBaseContext ¶
func NewBaseContext(opts NewBaseContextOpts) *BaseContext
func (*BaseContext) AddKeybindingsFn ¶
func (self *BaseContext) AddKeybindingsFn(fn types.KeybindingsFn)
func (*BaseContext) AddMouseKeybindingsFn ¶
func (self *BaseContext) AddMouseKeybindingsFn(fn types.MouseKeybindingsFn)
func (*BaseContext) AddOnClickFn ¶
func (self *BaseContext) AddOnClickFn(fn func() error)
func (*BaseContext) AddOnFocusFn ¶
func (self *BaseContext) AddOnFocusFn(fn onFocusFn)
func (*BaseContext) AddOnFocusLostFn ¶
func (self *BaseContext) AddOnFocusLostFn(fn onFocusLostFn)
func (*BaseContext) AddOnRenderToMainFn ¶
func (self *BaseContext) AddOnRenderToMainFn(fn func() error)
func (*BaseContext) GetKey ¶
func (self *BaseContext) GetKey() types.ContextKey
func (*BaseContext) GetKeybindings ¶
func (self *BaseContext) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding
func (*BaseContext) GetKind ¶
func (self *BaseContext) GetKind() types.ContextKind
func (*BaseContext) GetMouseKeybindings ¶
func (self *BaseContext) GetMouseKeybindings(opts types.KeybindingsOpts) []*gocui.ViewMouseBinding
func (*BaseContext) GetOnClick ¶
func (self *BaseContext) GetOnClick() func() error
func (*BaseContext) GetOnFocus ¶
func (self *BaseContext) GetOnFocus() onFocusFn
func (*BaseContext) GetOnFocusLost ¶
func (self *BaseContext) GetOnFocusLost() onFocusLostFn
func (*BaseContext) GetOnRenderToMain ¶
func (self *BaseContext) GetOnRenderToMain() func() error
func (*BaseContext) GetOptionsMap ¶
func (self *BaseContext) GetOptionsMap() map[string]string
func (*BaseContext) GetView ¶
func (self *BaseContext) GetView() *gocui.View
func (*BaseContext) GetViewName ¶
func (self *BaseContext) GetViewName() string
func (*BaseContext) GetViewTrait ¶
func (self *BaseContext) GetViewTrait() types.IViewTrait
func (*BaseContext) GetWindowName ¶
func (self *BaseContext) GetWindowName() string
func (*BaseContext) HasControlledBounds ¶
func (self *BaseContext) HasControlledBounds() bool
func (*BaseContext) IsFocusable ¶
func (self *BaseContext) IsFocusable() bool
func (*BaseContext) IsTransient ¶
func (self *BaseContext) IsTransient() bool
func (*BaseContext) NeedsRerenderOnWidthChange ¶
func (self *BaseContext) NeedsRerenderOnWidthChange() bool
func (*BaseContext) SetWindowName ¶
func (self *BaseContext) SetWindowName(windowName string)
func (*BaseContext) Title ¶
func (self *BaseContext) Title() string
type BranchesContext ¶
type BranchesContext struct { *FilteredListViewModel[*models.Branch] *ListContextTrait }
func NewBranchesContext ¶
func NewBranchesContext(c *ContextCommon) *BranchesContext
func (*BranchesContext) GetDiffTerminals ¶
func (self *BranchesContext) GetDiffTerminals() []string
func (*BranchesContext) GetSelectedRef ¶
func (self *BranchesContext) GetSelectedRef() types.Ref
func (*BranchesContext) ShowBranchHeadsInSubCommits ¶
func (self *BranchesContext) ShowBranchHeadsInSubCommits() bool
type CommitFilesContext ¶
type CommitFilesContext struct { *filetree.CommitFileTreeViewModel *ListContextTrait *DynamicTitleBuilder *SearchTrait }
func NewCommitFilesContext ¶
func NewCommitFilesContext(c *ContextCommon) *CommitFilesContext
func (*CommitFilesContext) GetDiffTerminals ¶
func (self *CommitFilesContext) GetDiffTerminals() []string
type CommitMessageContext ¶
func NewCommitMessageContext ¶
func NewCommitMessageContext( c *ContextCommon, ) *CommitMessageContext
func (*CommitMessageContext) CanSwitchToEditor ¶
func (self *CommitMessageContext) CanSwitchToEditor() bool
func (*CommitMessageContext) GetHistoryMessage ¶
func (self *CommitMessageContext) GetHistoryMessage() string
func (*CommitMessageContext) GetPreserveMessage ¶
func (self *CommitMessageContext) GetPreserveMessage() bool
func (*CommitMessageContext) GetPreservedMessage ¶
func (self *CommitMessageContext) GetPreservedMessage() string
func (*CommitMessageContext) GetSelectedIndex ¶
func (self *CommitMessageContext) GetSelectedIndex() int
func (*CommitMessageContext) OnConfirm ¶
func (self *CommitMessageContext) OnConfirm(summary string, description string) error
func (*CommitMessageContext) RenderCommitLength ¶
func (self *CommitMessageContext) RenderCommitLength()
func (*CommitMessageContext) SetHistoryMessage ¶
func (self *CommitMessageContext) SetHistoryMessage(message string)
func (*CommitMessageContext) SetPanelState ¶
func (*CommitMessageContext) SetPreservedMessage ¶
func (self *CommitMessageContext) SetPreservedMessage(message string)
func (*CommitMessageContext) SetSelectedIndex ¶
func (self *CommitMessageContext) SetSelectedIndex(value int)
func (*CommitMessageContext) SwitchToEditor ¶
func (self *CommitMessageContext) SwitchToEditor(message string) error
type CommitMessageViewModel ¶
type CommitMessageViewModel struct {
// contains filtered or unexported fields
}
type ConfirmationContext ¶
type ConfirmationContext struct { *SimpleContext State ConfirmationContextState // contains filtered or unexported fields }
func NewConfirmationContext ¶
func NewConfirmationContext( c *ContextCommon, ) *ConfirmationContext
type ConflictsViewModel ¶
type ConflictsViewModel struct {
// contains filtered or unexported fields
}
type ContextCommon ¶
type ContextCommon struct { *common.Common types.IGuiCommon }
type ContextTree ¶
type ContextTree struct { Global types.Context Status types.Context Snake types.Context Files *WorkingTreeContext Menu *MenuContext Branches *BranchesContext Tags *TagsContext LocalCommits *LocalCommitsContext CommitFiles *CommitFilesContext Remotes *RemotesContext Worktrees *WorktreesContext Submodules *SubmodulesContext RemoteBranches *RemoteBranchesContext ReflogCommits *ReflogCommitsContext SubCommits *SubCommitsContext Stash *StashContext Suggestions *SuggestionsContext Normal types.Context NormalSecondary types.Context Staging *PatchExplorerContext StagingSecondary *PatchExplorerContext CustomPatchBuilder *PatchExplorerContext CustomPatchBuilderSecondary types.Context MergeConflicts *MergeConflictsContext Confirmation *ConfirmationContext CommitMessage *CommitMessageContext CommitDescription types.Context CommandLog types.Context // display contexts AppStatus types.Context Options types.Context SearchPrefix types.Context Search types.Context Information types.Context Limit types.Context StatusSpacer1 types.Context StatusSpacer2 types.Context }
func NewContextTree ¶
func NewContextTree(c *ContextCommon) *ContextTree
func (*ContextTree) Flatten ¶
func (self *ContextTree) Flatten() []types.Context
the order of this decides which context is initially at the top of its window
type DynamicTitleBuilder ¶
type DynamicTitleBuilder struct {
// contains filtered or unexported fields
}
func NewDynamicTitleBuilder ¶
func NewDynamicTitleBuilder(formatStr string) *DynamicTitleBuilder
func (*DynamicTitleBuilder) SetTitleRef ¶
func (self *DynamicTitleBuilder) SetTitleRef(titleRef string)
func (*DynamicTitleBuilder) Title ¶
func (self *DynamicTitleBuilder) Title() string
type FilteredList ¶
type FilteredList[T any] struct { // contains filtered or unexported fields }
func NewFilteredList ¶
func NewFilteredList[T any](getList func() []T, getFilterFields func(T) []string, shouldRetainSortOrder func() bool) *FilteredList[T]
func (*FilteredList[T]) ClearFilter ¶
func (self *FilteredList[T]) ClearFilter()
func (*FilteredList[T]) GetFilter ¶
func (self *FilteredList[T]) GetFilter() string
func (*FilteredList[T]) GetFilteredList ¶
func (self *FilteredList[T]) GetFilteredList() []T
func (*FilteredList[T]) IsFiltering ¶
func (self *FilteredList[T]) IsFiltering() bool
func (*FilteredList[T]) ReApplyFilter ¶
func (self *FilteredList[T]) ReApplyFilter()
func (*FilteredList[T]) SetFilter ¶
func (self *FilteredList[T]) SetFilter(filter string)
func (*FilteredList[T]) UnfilteredIndex ¶
func (self *FilteredList[T]) UnfilteredIndex(index int) int
func (*FilteredList[T]) UnfilteredLen ¶
func (self *FilteredList[T]) UnfilteredLen() int
TODO: update to just 'Len'
type FilteredListViewModel ¶
type FilteredListViewModel[T HasID] struct { *FilteredList[T] *ListViewModel[T] *SearchHistory }
func NewFilteredListViewModel ¶
func NewFilteredListViewModel[T HasID](getList func() []T, getFilterFields func(T) []string, shouldRetainSortOrder func() bool) *FilteredListViewModel[T]
func (*FilteredListViewModel[T]) ClearFilter ¶
func (self *FilteredListViewModel[T]) ClearFilter()
func (*FilteredListViewModel[T]) IsFilterableContext ¶
func (self *FilteredListViewModel[T]) IsFilterableContext()
used for type switch
type ListContextTrait ¶
type ListContextTrait struct { types.Context ListRenderer // contains filtered or unexported fields }
func (*ListContextTrait) FocusLine ¶
func (self *ListContextTrait) FocusLine()
func (*ListContextTrait) HandleFocus ¶
func (self *ListContextTrait) HandleFocus(opts types.OnFocusOpts) error
func (*ListContextTrait) HandleFocusLost ¶
func (self *ListContextTrait) HandleFocusLost(opts types.OnFocusLostOpts) error
func (*ListContextTrait) HandleRender ¶
func (self *ListContextTrait) HandleRender() error
OnFocus assumes that the content of the context has already been rendered to the view. OnRender is the function which actually renders the content to the view
func (*ListContextTrait) IsItemVisible ¶
func (self *ListContextTrait) IsItemVisible(item types.HasUrn) bool
func (*ListContextTrait) IsListContext ¶
func (self *ListContextTrait) IsListContext()
func (*ListContextTrait) OnSearchSelect ¶
func (self *ListContextTrait) OnSearchSelect(selectedLineIdx int) error
func (*ListContextTrait) RangeSelectEnabled ¶
func (self *ListContextTrait) RangeSelectEnabled() bool
By default, list contexts supporta range select
type ListRenderer ¶
type ListRenderer struct {
// contains filtered or unexported fields
}
func (*ListRenderer) GetList ¶
func (self *ListRenderer) GetList() types.IList
func (*ListRenderer) ModelIndexToViewIndex ¶
func (self *ListRenderer) ModelIndexToViewIndex(modelIndex int) int
func (*ListRenderer) ViewIndexToModelIndex ¶
func (self *ListRenderer) ViewIndexToModelIndex(viewIndex int) int
type ListViewModel ¶
type ListViewModel[T HasID] struct { *traits.ListCursor // contains filtered or unexported fields }
func NewListViewModel ¶
func NewListViewModel[T HasID](getModel func() []T) *ListViewModel[T]
func (*ListViewModel[T]) GetItems ¶
func (self *ListViewModel[T]) GetItems() []T
func (*ListViewModel[T]) GetSelected ¶
func (self *ListViewModel[T]) GetSelected() T
func (*ListViewModel[T]) GetSelectedItemId ¶
func (self *ListViewModel[T]) GetSelectedItemId() string
func (*ListViewModel[T]) GetSelectedItemIds ¶
func (self *ListViewModel[T]) GetSelectedItemIds() ([]string, int, int)
func (*ListViewModel[T]) GetSelectedItems ¶
func (self *ListViewModel[T]) GetSelectedItems() ([]T, int, int)
type LocalCommitsContext ¶
type LocalCommitsContext struct { *LocalCommitsViewModel *ListContextTrait *SearchTrait }
func NewLocalCommitsContext ¶
func NewLocalCommitsContext(c *ContextCommon) *LocalCommitsContext
func (*LocalCommitsContext) CanRebase ¶
func (self *LocalCommitsContext) CanRebase() bool
func (*LocalCommitsContext) GetDiffTerminals ¶
func (self *LocalCommitsContext) GetDiffTerminals() []string
func (*LocalCommitsContext) GetSelectedRef ¶
func (self *LocalCommitsContext) GetSelectedRef() types.Ref
type LocalCommitsViewModel ¶
type LocalCommitsViewModel struct { *ListViewModel[*models.Commit] // contains filtered or unexported fields }
func NewLocalCommitsViewModel ¶
func NewLocalCommitsViewModel(getModel func() []*models.Commit, c *ContextCommon) *LocalCommitsViewModel
func (*LocalCommitsViewModel) GetCommits ¶
func (self *LocalCommitsViewModel) GetCommits() []*models.Commit
func (*LocalCommitsViewModel) GetLimitCommits ¶
func (self *LocalCommitsViewModel) GetLimitCommits() bool
func (*LocalCommitsViewModel) GetShowWholeGitGraph ¶
func (self *LocalCommitsViewModel) GetShowWholeGitGraph() bool
func (*LocalCommitsViewModel) SetLimitCommits ¶
func (self *LocalCommitsViewModel) SetLimitCommits(value bool)
func (*LocalCommitsViewModel) SetShowWholeGitGraph ¶
func (self *LocalCommitsViewModel) SetShowWholeGitGraph(value bool)
type MenuContext ¶
type MenuContext struct { *MenuViewModel *ListContextTrait // contains filtered or unexported fields }
func NewMenuContext ¶
func NewMenuContext( c *ContextCommon, ) *MenuContext
func (*MenuContext) GetKeybindings ¶
func (self *MenuContext) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding
func (*MenuContext) OnMenuPress ¶
func (self *MenuContext) OnMenuPress(selectedItem *types.MenuItem) error
func (*MenuContext) RangeSelectEnabled ¶
func (self *MenuContext) RangeSelectEnabled() bool
There is currently no need to use range-select in a menu so we're disabling it.
type MenuViewModel ¶
type MenuViewModel struct { *FilteredListViewModel[*types.MenuItem] // contains filtered or unexported fields }
func NewMenuViewModel ¶
func NewMenuViewModel(c *ContextCommon) *MenuViewModel
func (*MenuViewModel) GetDisplayStrings ¶
func (self *MenuViewModel) GetDisplayStrings(_ int, _ int) [][]string
TODO: move into presentation package
func (*MenuViewModel) GetNonModelItems ¶
func (self *MenuViewModel) GetNonModelItems() []*NonModelItem
func (*MenuViewModel) SetMenuItems ¶
func (self *MenuViewModel) SetMenuItems(items []*types.MenuItem, columnAlignment []utils.Alignment)
type MergeConflictsContext ¶
func NewMergeConflictsContext ¶
func NewMergeConflictsContext( c *ContextCommon, ) *MergeConflictsContext
func (*MergeConflictsContext) FocusSelection ¶
func (self *MergeConflictsContext) FocusSelection()
func (*MergeConflictsContext) GetContentToRender ¶
func (self *MergeConflictsContext) GetContentToRender() string
func (*MergeConflictsContext) GetMutex ¶
func (self *MergeConflictsContext) GetMutex() *deadlock.Mutex
func (*MergeConflictsContext) GetOriginY ¶
func (self *MergeConflictsContext) GetOriginY() int
func (*MergeConflictsContext) GetState ¶
func (self *MergeConflictsContext) GetState() *mergeconflicts.State
func (*MergeConflictsContext) IsUserScrolling ¶
func (self *MergeConflictsContext) IsUserScrolling() bool
func (*MergeConflictsContext) Render ¶
func (self *MergeConflictsContext) Render() error
func (*MergeConflictsContext) RenderAndFocus ¶
func (self *MergeConflictsContext) RenderAndFocus() error
func (*MergeConflictsContext) SetSelectedLineRange ¶
func (self *MergeConflictsContext) SetSelectedLineRange()
func (*MergeConflictsContext) SetState ¶
func (self *MergeConflictsContext) SetState(state *mergeconflicts.State)
func (*MergeConflictsContext) SetUserScrolling ¶
func (self *MergeConflictsContext) SetUserScrolling(isScrolling bool)
type NewBaseContextOpts ¶
type NewBaseContextOpts struct { Kind types.ContextKind Key types.ContextKey View *gocui.View WindowName string Focusable bool Transient bool HasUncontrolledBounds bool // negating for the sake of making false the default HighlightOnFocus bool NeedsRerenderOnWidthChange bool OnGetOptionsMap func() map[string]string }
type NonModelItem ¶
type ParentContextMgr ¶
type ParentContextMgr struct { ParentContext types.Context // contains filtered or unexported fields }
func (*ParentContextMgr) GetParentContext ¶
func (self *ParentContextMgr) GetParentContext() (types.Context, bool)
func (*ParentContextMgr) SetParentContext ¶
func (self *ParentContextMgr) SetParentContext(context types.Context)
type PatchExplorerContext ¶
type PatchExplorerContext struct { *SimpleContext *SearchTrait // contains filtered or unexported fields }
func NewPatchExplorerContext ¶
func NewPatchExplorerContext( view *gocui.View, windowName string, key types.ContextKey, getIncludedLineIndices func() []int, c *ContextCommon, ) *PatchExplorerContext
func (*PatchExplorerContext) Focus ¶
func (self *PatchExplorerContext) Focus() error
func (*PatchExplorerContext) FocusSelection ¶
func (self *PatchExplorerContext) FocusSelection()
func (*PatchExplorerContext) GetContentToRender ¶
func (self *PatchExplorerContext) GetContentToRender(isFocused bool) string
func (*PatchExplorerContext) GetIncludedLineIndices ¶
func (self *PatchExplorerContext) GetIncludedLineIndices() []int
func (*PatchExplorerContext) GetMutex ¶
func (self *PatchExplorerContext) GetMutex() *deadlock.Mutex
func (*PatchExplorerContext) GetState ¶
func (self *PatchExplorerContext) GetState() *patch_exploring.State
func (*PatchExplorerContext) GetViewTrait ¶
func (self *PatchExplorerContext) GetViewTrait() types.IViewTrait
func (*PatchExplorerContext) IsPatchExplorerContext ¶
func (self *PatchExplorerContext) IsPatchExplorerContext()
func (*PatchExplorerContext) NavigateTo ¶
func (self *PatchExplorerContext) NavigateTo(isFocused bool, selectedLineIdx int) error
func (*PatchExplorerContext) Render ¶
func (self *PatchExplorerContext) Render(isFocused bool) error
func (*PatchExplorerContext) RenderAndFocus ¶
func (self *PatchExplorerContext) RenderAndFocus(isFocused bool) error
func (*PatchExplorerContext) SetState ¶
func (self *PatchExplorerContext) SetState(state *patch_exploring.State)
type ReflogCommitsContext ¶
type ReflogCommitsContext struct { *FilteredListViewModel[*models.Commit] *ListContextTrait }
func NewReflogCommitsContext ¶
func NewReflogCommitsContext(c *ContextCommon) *ReflogCommitsContext
func (*ReflogCommitsContext) CanRebase ¶
func (self *ReflogCommitsContext) CanRebase() bool
func (*ReflogCommitsContext) GetCommits ¶
func (self *ReflogCommitsContext) GetCommits() []*models.Commit
func (*ReflogCommitsContext) GetDiffTerminals ¶
func (self *ReflogCommitsContext) GetDiffTerminals() []string
func (*ReflogCommitsContext) GetSelectedRef ¶
func (self *ReflogCommitsContext) GetSelectedRef() types.Ref
func (*ReflogCommitsContext) ShowBranchHeadsInSubCommits ¶
func (self *ReflogCommitsContext) ShowBranchHeadsInSubCommits() bool
type RemoteBranchesContext ¶
type RemoteBranchesContext struct { *FilteredListViewModel[*models.RemoteBranch] *ListContextTrait *DynamicTitleBuilder }
func NewRemoteBranchesContext ¶
func NewRemoteBranchesContext( c *ContextCommon, ) *RemoteBranchesContext
func (*RemoteBranchesContext) GetDiffTerminals ¶
func (self *RemoteBranchesContext) GetDiffTerminals() []string
func (*RemoteBranchesContext) GetSelectedRef ¶
func (self *RemoteBranchesContext) GetSelectedRef() types.Ref
func (*RemoteBranchesContext) GetSelectedRefs ¶
func (self *RemoteBranchesContext) GetSelectedRefs() ([]types.Ref, int, int)
func (*RemoteBranchesContext) ShowBranchHeadsInSubCommits ¶
func (self *RemoteBranchesContext) ShowBranchHeadsInSubCommits() bool
type RemotesContext ¶
type RemotesContext struct { *FilteredListViewModel[*models.Remote] *ListContextTrait }
func NewRemotesContext ¶
func NewRemotesContext(c *ContextCommon) *RemotesContext
func (*RemotesContext) GetDiffTerminals ¶
func (self *RemotesContext) GetDiffTerminals() []string
type SearchHistory ¶
type SearchHistory struct {
// contains filtered or unexported fields
}
Maintains a list of strings that have previously been searched/filtered for
func NewSearchHistory ¶
func NewSearchHistory() *SearchHistory
func (*SearchHistory) GetSearchHistory ¶
func (self *SearchHistory) GetSearchHistory() *utils.HistoryBuffer[string]
type SearchTrait ¶
type SearchTrait struct { *SearchHistory // contains filtered or unexported fields }
func NewSearchTrait ¶
func NewSearchTrait(c *ContextCommon) *SearchTrait
func (*SearchTrait) ClearSearchString ¶
func (self *SearchTrait) ClearSearchString()
func (*SearchTrait) GetSearchString ¶
func (self *SearchTrait) GetSearchString() string
func (*SearchTrait) IsSearchableContext ¶
func (self *SearchTrait) IsSearchableContext()
used for type switch
func (*SearchTrait) IsSearching ¶
func (self *SearchTrait) IsSearching() bool
func (*SearchTrait) RenderSearchStatus ¶
func (self *SearchTrait) RenderSearchStatus(index int, total int)
func (*SearchTrait) SetSearchString ¶
func (self *SearchTrait) SetSearchString(searchString string)
type SimpleContext ¶
type SimpleContext struct {
*BaseContext
}
func NewSimpleContext ¶
func NewSimpleContext(baseContext *BaseContext) *SimpleContext
func (*SimpleContext) HandleFocus ¶
func (self *SimpleContext) HandleFocus(opts types.OnFocusOpts) error
func (*SimpleContext) HandleFocusLost ¶
func (self *SimpleContext) HandleFocusLost(opts types.OnFocusLostOpts) error
func (*SimpleContext) HandleRender ¶
func (self *SimpleContext) HandleRender() error
func (*SimpleContext) HandleRenderToMain ¶
func (self *SimpleContext) HandleRenderToMain() error
type StashContext ¶
type StashContext struct { *FilteredListViewModel[*models.StashEntry] *ListContextTrait }
func NewStashContext ¶
func NewStashContext( c *ContextCommon, ) *StashContext
func (*StashContext) CanRebase ¶
func (self *StashContext) CanRebase() bool
func (*StashContext) GetDiffTerminals ¶
func (self *StashContext) GetDiffTerminals() []string
func (*StashContext) GetSelectedRef ¶
func (self *StashContext) GetSelectedRef() types.Ref
type SubCommitsContext ¶
type SubCommitsContext struct { *SubCommitsViewModel *ListContextTrait *DynamicTitleBuilder *SearchTrait // contains filtered or unexported fields }
func NewSubCommitsContext ¶
func NewSubCommitsContext( c *ContextCommon, ) *SubCommitsContext
func (*SubCommitsContext) CanRebase ¶
func (self *SubCommitsContext) CanRebase() bool
func (*SubCommitsContext) GetCommits ¶
func (self *SubCommitsContext) GetCommits() []*models.Commit
func (*SubCommitsContext) GetDiffTerminals ¶
func (self *SubCommitsContext) GetDiffTerminals() []string
func (*SubCommitsContext) GetLimitCommits ¶
func (self *SubCommitsContext) GetLimitCommits() bool
func (*SubCommitsContext) GetSelectedRef ¶
func (self *SubCommitsContext) GetSelectedRef() types.Ref
func (*SubCommitsContext) SetLimitCommits ¶
func (self *SubCommitsContext) SetLimitCommits(value bool)
type SubCommitsViewModel ¶
type SubCommitsViewModel struct { *ListViewModel[*models.Commit] // contains filtered or unexported fields }
func (*SubCommitsViewModel) GetRef ¶
func (self *SubCommitsViewModel) GetRef() types.Ref
func (*SubCommitsViewModel) GetRefToShowDivergenceFrom ¶
func (self *SubCommitsViewModel) GetRefToShowDivergenceFrom() string
func (*SubCommitsViewModel) GetShowBranchHeads ¶
func (self *SubCommitsViewModel) GetShowBranchHeads() bool
func (*SubCommitsViewModel) SetRef ¶
func (self *SubCommitsViewModel) SetRef(ref types.Ref)
func (*SubCommitsViewModel) SetRefToShowDivergenceFrom ¶
func (self *SubCommitsViewModel) SetRefToShowDivergenceFrom(ref string)
func (*SubCommitsViewModel) SetShowBranchHeads ¶
func (self *SubCommitsViewModel) SetShowBranchHeads(value bool)
type SubmodulesContext ¶
type SubmodulesContext struct { *FilteredListViewModel[*models.SubmoduleConfig] *ListContextTrait }
func NewSubmodulesContext ¶
func NewSubmodulesContext(c *ContextCommon) *SubmodulesContext
type SuggestionsContext ¶
type SuggestionsContext struct { *ListViewModel[*types.Suggestion] *ListContextTrait State *SuggestionsContextState }
func NewSuggestionsContext ¶
func NewSuggestionsContext( c *ContextCommon, ) *SuggestionsContext
func (*SuggestionsContext) RangeSelectEnabled ¶
func (self *SuggestionsContext) RangeSelectEnabled() bool
There is currently no need to use range-select in the suggestions view so we're disabling it.
func (*SuggestionsContext) RefreshSuggestions ¶
func (self *SuggestionsContext) RefreshSuggestions()
func (*SuggestionsContext) SetSuggestions ¶
func (self *SuggestionsContext) SetSuggestions(suggestions []*types.Suggestion)
type SuggestionsContextState ¶
type SuggestionsContextState struct { Suggestions []*types.Suggestion OnConfirm func() error OnClose func() error AsyncHandler *tasks.AsyncHandler // FindSuggestions will take a string that the user has typed into a prompt // and return a slice of suggestions which match that string. FindSuggestions func(string) []*types.Suggestion }
type TagsContext ¶
type TagsContext struct { *FilteredListViewModel[*models.Tag] *ListContextTrait }
func NewTagsContext ¶
func NewTagsContext( c *ContextCommon, ) *TagsContext
func (*TagsContext) GetDiffTerminals ¶
func (self *TagsContext) GetDiffTerminals() []string
func (*TagsContext) GetSelectedRef ¶
func (self *TagsContext) GetSelectedRef() types.Ref
func (*TagsContext) ShowBranchHeadsInSubCommits ¶
func (self *TagsContext) ShowBranchHeadsInSubCommits() bool
type ViewTrait ¶
type ViewTrait struct {
// contains filtered or unexported fields
}
func NewViewTrait ¶
func (*ViewTrait) CancelRangeSelect ¶
func (self *ViewTrait) CancelRangeSelect()
func (*ViewTrait) FocusPoint ¶
func (*ViewTrait) ScrollDown ¶
func (*ViewTrait) ScrollLeft ¶
func (self *ViewTrait) ScrollLeft()
func (*ViewTrait) ScrollRight ¶
func (self *ViewTrait) ScrollRight()
func (*ViewTrait) SelectedLineIdx ¶
func (*ViewTrait) SetContent ¶
func (*ViewTrait) SetHighlight ¶
func (*ViewTrait) SetOriginX ¶
func (*ViewTrait) SetRangeSelectStart ¶
func (*ViewTrait) SetViewPortContent ¶
func (*ViewTrait) ViewPortYBounds ¶
tells us the start of line indexes shown in the view currently as well as the capacity of lines shown in the viewport.
type WorkingTreeContext ¶
type WorkingTreeContext struct { *filetree.FileTreeViewModel *ListContextTrait *SearchTrait }
func NewWorkingTreeContext ¶
func NewWorkingTreeContext(c *ContextCommon) *WorkingTreeContext
type WorktreesContext ¶
type WorktreesContext struct { *FilteredListViewModel[*models.Worktree] *ListContextTrait }
func NewWorktreesContext ¶
func NewWorktreesContext(c *ContextCommon) *WorktreesContext
Source Files ¶
- base_context.go
- branches_context.go
- commit_files_context.go
- commit_message_context.go
- confirmation_context.go
- context.go
- context_common.go
- dynamic_title_builder.go
- filtered_list.go
- filtered_list_view_model.go
- history_trait.go
- list_context_trait.go
- list_renderer.go
- list_view_model.go
- local_commits_context.go
- menu_context.go
- merge_conflicts_context.go
- parent_context_mgr.go
- patch_explorer_context.go
- reflog_commits_context.go
- remote_branches_context.go
- remotes_context.go
- search_trait.go
- setup.go
- simple_context.go
- stash_context.go
- sub_commits_context.go
- submodules_context.go
- suggestions_context.go
- tags_context.go
- view_trait.go
- working_tree_context.go
- worktrees_context.go