context

package
v0.0.0-...-00ab8b8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
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"
)
View Source
const HORIZONTAL_SCROLL_FACTOR = 3
View Source
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

Functions

func NewDisplayContext

func NewDisplayContext(key types.ContextKey, view *gocui.View, windowName string) types.Context

A Display context only renders a view. It has no keybindings and is not focusable.

func Zero

func Zero[T any]() T

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

func NewCommitFilesContext

func NewCommitFilesContext(c *ContextCommon) *CommitFilesContext

func (*CommitFilesContext) GetDiffTerminals

func (self *CommitFilesContext) GetDiffTerminals() []string

type CommitMessageContext

type CommitMessageContext struct {
	types.Context
	// contains filtered or unexported fields
}

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 (self *CommitMessageContext) SetPanelState(
	index int,
	summaryTitle string,
	descriptionTitle string,
	preserveMessage bool,
	onConfirm func(string, string) error,
	onSwitchToEditor func(string) error,
)

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 ConfirmationContextState

type ConfirmationContextState struct {
	OnConfirm func() error
	OnClose   func() error
}

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 HasID

type HasID interface {
	ID() string
}

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]) GetItem

func (self *ListViewModel[T]) GetItem(index int) types.HasUrn

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 struct {
	*MenuViewModel
	*ListContextTrait
	// contains filtered or unexported fields
}

func NewMenuContext

func NewMenuContext(
	c *ContextCommon,
) *MenuContext
func (self *MenuContext) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding
func (self *MenuContext) OnMenuPress(selectedItem *types.MenuItem) error
func (self *MenuContext) RangeSelectEnabled() bool

There is currently no need to use range-select in a menu so we're disabling it.

type MenuViewModel struct {
	*FilteredListViewModel[*types.MenuItem]
	// contains filtered or unexported fields
}

func NewMenuViewModel

func NewMenuViewModel(c *ContextCommon) *MenuViewModel
func (self *MenuViewModel) GetDisplayStrings(_ int, _ int) [][]string

TODO: move into presentation package

func (self *MenuViewModel) GetNonModelItems() []*NonModelItem
func (self *MenuViewModel) SetMenuItems(items []*types.MenuItem, columnAlignment []utils.Alignment)

type MergeConflictsContext

type MergeConflictsContext struct {
	types.Context
	// contains filtered or unexported fields
}

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 NonModelItem struct {
	// Where in the model this should be inserted
	Index int
	// Content to render
	Content string
	// The column from which to render the item
	Column int
}

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

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 TabView

type TabView struct {
	Tab      string
	ViewName string
}

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 NewViewTrait(view *gocui.View) *ViewTrait

func (*ViewTrait) CancelRangeSelect

func (self *ViewTrait) CancelRangeSelect()

func (*ViewTrait) FocusPoint

func (self *ViewTrait) FocusPoint(yIdx int)

func (*ViewTrait) PageDelta

func (self *ViewTrait) PageDelta() int

this returns the amount we'll scroll if we want to scroll by a page.

func (*ViewTrait) ScrollDown

func (self *ViewTrait) ScrollDown(value int)

func (*ViewTrait) ScrollLeft

func (self *ViewTrait) ScrollLeft()

func (*ViewTrait) ScrollRight

func (self *ViewTrait) ScrollRight()

func (*ViewTrait) ScrollUp

func (self *ViewTrait) ScrollUp(value int)

func (*ViewTrait) SelectedLineIdx

func (self *ViewTrait) SelectedLineIdx() int

func (*ViewTrait) SetContent

func (self *ViewTrait) SetContent(content string)

func (*ViewTrait) SetFooter

func (self *ViewTrait) SetFooter(value string)

func (*ViewTrait) SetHighlight

func (self *ViewTrait) SetHighlight(highlight bool)

func (*ViewTrait) SetOriginX

func (self *ViewTrait) SetOriginX(value int)

func (*ViewTrait) SetRangeSelectStart

func (self *ViewTrait) SetRangeSelectStart(yIdx int)

func (*ViewTrait) SetViewPortContent

func (self *ViewTrait) SetViewPortContent(content string)

func (*ViewTrait) ViewPortYBounds

func (self *ViewTrait) ViewPortYBounds() (int, int)

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL