context

package
v0.40.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2023 License: MIT Imports: 25 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"

	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 added in v0.36.0

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 added in v0.39.0

func (self *BaseContext) AddOnFocusFn(fn onFocusFn)

func (*BaseContext) AddOnFocusLostFn added in v0.39.0

func (self *BaseContext) AddOnFocusLostFn(fn onFocusLostFn)

func (*BaseContext) AddOnRenderToMainFn added in v0.39.0

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 added in v0.39.0

func (self *BaseContext) GetOnFocus() onFocusFn

func (*BaseContext) GetOnFocusLost added in v0.39.0

func (self *BaseContext) GetOnFocusLost() onFocusLostFn

func (*BaseContext) GetOnRenderToMain added in v0.39.0

func (self *BaseContext) GetOnRenderToMain() func() error

func (*BaseContext) GetOptionsMap

func (self *BaseContext) GetOptionsMap() map[string]string

func (*BaseContext) GetView added in v0.36.0

func (self *BaseContext) GetView() *gocui.View

func (*BaseContext) GetViewName

func (self *BaseContext) GetViewName() string

func (*BaseContext) GetViewTrait added in v0.36.0

func (self *BaseContext) GetViewTrait() types.IViewTrait

func (*BaseContext) GetWindowName

func (self *BaseContext) GetWindowName() string

func (*BaseContext) HasControlledBounds added in v0.36.0

func (self *BaseContext) HasControlledBounds() bool

func (*BaseContext) IsFocusable

func (self *BaseContext) IsFocusable() bool

func (*BaseContext) IsTransient

func (self *BaseContext) IsTransient() 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 added in v0.39.0

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

func (*BranchesContext) GetSelectedItemId

func (self *BranchesContext) GetSelectedItemId() string

func (*BranchesContext) GetSelectedRef

func (self *BranchesContext) GetSelectedRef() types.Ref

func (*BranchesContext) ShowBranchHeadsInSubCommits added in v0.40.0

func (self *BranchesContext) ShowBranchHeadsInSubCommits() bool

type CommitFilesContext

func NewCommitFilesContext

func NewCommitFilesContext(c *ContextCommon) *CommitFilesContext

func (*CommitFilesContext) GetDiffTerminals added in v0.39.0

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

func (*CommitFilesContext) GetSelectedItemId

func (self *CommitFilesContext) GetSelectedItemId() string

type CommitMessageContext added in v0.38.0

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

func NewCommitMessageContext added in v0.38.0

func NewCommitMessageContext(
	c *ContextCommon,
) *CommitMessageContext

func (*CommitMessageContext) GetHistoryMessage added in v0.38.0

func (self *CommitMessageContext) GetHistoryMessage() string

func (*CommitMessageContext) GetPreserveMessage added in v0.38.0

func (self *CommitMessageContext) GetPreserveMessage() bool

func (*CommitMessageContext) GetPreservedMessage added in v0.38.0

func (self *CommitMessageContext) GetPreservedMessage() string

func (*CommitMessageContext) GetSelectedIndex added in v0.38.0

func (self *CommitMessageContext) GetSelectedIndex() int

func (*CommitMessageContext) OnConfirm added in v0.38.0

func (self *CommitMessageContext) OnConfirm(summary string, description string) error

func (*CommitMessageContext) RenderCommitLength added in v0.39.0

func (self *CommitMessageContext) RenderCommitLength()

func (*CommitMessageContext) SetHistoryMessage added in v0.38.0

func (self *CommitMessageContext) SetHistoryMessage(message string)

func (*CommitMessageContext) SetPanelState added in v0.38.0

func (self *CommitMessageContext) SetPanelState(
	index int,
	summaryTitle string,
	descriptionTitle string,
	preserveMessage bool,
	onConfirm func(string, string) error,
)

func (*CommitMessageContext) SetPreservedMessage added in v0.38.0

func (self *CommitMessageContext) SetPreservedMessage(message string)

func (*CommitMessageContext) SetSelectedIndex added in v0.38.0

func (self *CommitMessageContext) SetSelectedIndex(value int)

type CommitMessageViewModel added in v0.38.0

type CommitMessageViewModel struct {
	// contains filtered or unexported fields
}

type ConfirmationContext added in v0.39.0

type ConfirmationContext struct {
	*SimpleContext

	State ConfirmationContextState
	// contains filtered or unexported fields
}

func NewConfirmationContext added in v0.39.0

func NewConfirmationContext(
	c *ContextCommon,
) *ConfirmationContext

type ConfirmationContextState added in v0.39.0

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

type ConflictsViewModel added in v0.36.0

type ConflictsViewModel struct {
	// contains filtered or unexported fields
}

type ContextCommon added in v0.39.0

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
}

func NewContextTree added in v0.39.0

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 added in v0.39.0

type FilteredList[T any] struct {
	// contains filtered or unexported fields
}

func NewFilteredList added in v0.39.0

func NewFilteredList[T any](getList func() []T, getFilterFields func(T) []string) *FilteredList[T]

func (*FilteredList[T]) ClearFilter added in v0.39.0

func (self *FilteredList[T]) ClearFilter()

func (*FilteredList[T]) GetFilter added in v0.39.0

func (self *FilteredList[T]) GetFilter() string

func (*FilteredList[T]) GetFilteredList added in v0.39.0

func (self *FilteredList[T]) GetFilteredList() []T

func (*FilteredList[T]) IsFiltering added in v0.39.0

func (self *FilteredList[T]) IsFiltering() bool

func (*FilteredList[T]) SetFilter added in v0.39.0

func (self *FilteredList[T]) SetFilter(filter string)

func (*FilteredList[T]) UnfilteredIndex added in v0.39.0

func (self *FilteredList[T]) UnfilteredIndex(index int) int

func (*FilteredList[T]) UnfilteredLen added in v0.39.0

func (self *FilteredList[T]) UnfilteredLen() int

TODO: update to just 'Len'

type FilteredListViewModel added in v0.39.0

type FilteredListViewModel[T any] struct {
	*FilteredList[T]
	*ListViewModel[T]
}

func NewFilteredListViewModel added in v0.39.0

func NewFilteredListViewModel[T any](getList func() []T, getFilterFields func(T) []string) *FilteredListViewModel[T]

func (*FilteredListViewModel[T]) ClearFilter added in v0.39.0

func (self *FilteredListViewModel[T]) ClearFilter()

func (*FilteredListViewModel[T]) IsFilterableContext added in v0.39.0

func (self *FilteredListViewModel[T]) IsFilterableContext()

used for type switch

type ListContextTrait

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

func (*ListContextTrait) FocusLine

func (self *ListContextTrait) FocusLine()

func (*ListContextTrait) GetList

func (self *ListContextTrait) GetList() types.IList

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) IsListContext added in v0.39.0

func (self *ListContextTrait) IsListContext()

func (*ListContextTrait) OnSearchSelect

func (self *ListContextTrait) OnSearchSelect(selectedLineIdx int) error

type ListViewModel added in v0.39.0

type ListViewModel[T any] struct {
	*traits.ListCursor
	// contains filtered or unexported fields
}

func NewListViewModel added in v0.39.0

func NewListViewModel[T any](getModel func() []T) *ListViewModel[T]

func (*ListViewModel[T]) GetItems added in v0.39.0

func (self *ListViewModel[T]) GetItems() []T

func (*ListViewModel[T]) GetSelected added in v0.39.0

func (self *ListViewModel[T]) GetSelected() T

func (*ListViewModel[T]) Len added in v0.39.0

func (self *ListViewModel[T]) Len() 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 added in v0.39.0

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

func (*LocalCommitsContext) GetSelectedItemId

func (self *LocalCommitsContext) GetSelectedItemId() 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) GetSelectedItemId() string

TODO: remove this thing.

func (self *MenuContext) OnMenuPress(selectedItem *types.MenuItem) error
type MenuViewModel struct {
	*FilteredListViewModel[*types.MenuItem]
	// contains filtered or unexported fields
}

func NewMenuViewModel

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

TODO: move into presentation package

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

type MergeConflictsContext added in v0.36.0

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

func NewMergeConflictsContext added in v0.36.0

func NewMergeConflictsContext(
	c *ContextCommon,
) *MergeConflictsContext

func (*MergeConflictsContext) FocusSelection added in v0.38.0

func (self *MergeConflictsContext) FocusSelection()

func (*MergeConflictsContext) GetContentToRender added in v0.36.0

func (self *MergeConflictsContext) GetContentToRender(isFocused bool) string

func (*MergeConflictsContext) GetMutex added in v0.36.0

func (self *MergeConflictsContext) GetMutex() *deadlock.Mutex

func (*MergeConflictsContext) GetOriginY added in v0.36.0

func (self *MergeConflictsContext) GetOriginY() int

func (*MergeConflictsContext) GetState added in v0.36.0

func (self *MergeConflictsContext) GetState() *mergeconflicts.State

func (*MergeConflictsContext) IsUserScrolling added in v0.36.0

func (self *MergeConflictsContext) IsUserScrolling() bool

func (*MergeConflictsContext) Render added in v0.36.0

func (self *MergeConflictsContext) Render(isFocused bool) error

func (*MergeConflictsContext) RenderAndFocus added in v0.36.0

func (self *MergeConflictsContext) RenderAndFocus(isFocused bool) error

func (*MergeConflictsContext) SetState added in v0.36.0

func (self *MergeConflictsContext) SetState(state *mergeconflicts.State)

func (*MergeConflictsContext) SetUserScrolling added in v0.36.0

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

	OnGetOptionsMap func() map[string]string
}

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 added in v0.36.0

type PatchExplorerContext struct {
	*SimpleContext
	*SearchTrait
	// contains filtered or unexported fields
}

func NewPatchExplorerContext added in v0.36.0

func NewPatchExplorerContext(
	view *gocui.View,
	windowName string,
	key types.ContextKey,

	getIncludedLineIndices func() []int,

	c *ContextCommon,
) *PatchExplorerContext

func (*PatchExplorerContext) Focus added in v0.36.0

func (self *PatchExplorerContext) Focus() error

func (*PatchExplorerContext) FocusSelection added in v0.38.0

func (self *PatchExplorerContext) FocusSelection()

func (*PatchExplorerContext) GetContentToRender added in v0.36.0

func (self *PatchExplorerContext) GetContentToRender(isFocused bool) string

func (*PatchExplorerContext) GetIncludedLineIndices added in v0.36.0

func (self *PatchExplorerContext) GetIncludedLineIndices() []int

func (*PatchExplorerContext) GetMutex added in v0.36.0

func (self *PatchExplorerContext) GetMutex() *deadlock.Mutex

func (*PatchExplorerContext) GetState added in v0.36.0

func (self *PatchExplorerContext) GetState() *patch_exploring.State

func (*PatchExplorerContext) GetViewTrait added in v0.36.0

func (self *PatchExplorerContext) GetViewTrait() types.IViewTrait

func (*PatchExplorerContext) IsPatchExplorerContext added in v0.39.0

func (self *PatchExplorerContext) IsPatchExplorerContext()

func (*PatchExplorerContext) NavigateTo added in v0.36.0

func (self *PatchExplorerContext) NavigateTo(isFocused bool, selectedLineIdx int) error

func (*PatchExplorerContext) Render added in v0.36.0

func (self *PatchExplorerContext) Render(isFocused bool) error

func (*PatchExplorerContext) RenderAndFocus added in v0.36.0

func (self *PatchExplorerContext) RenderAndFocus(isFocused bool) error

func (*PatchExplorerContext) SetState added in v0.36.0

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 added in v0.39.0

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

func (*ReflogCommitsContext) GetSelectedItemId

func (self *ReflogCommitsContext) GetSelectedItemId() string

func (*ReflogCommitsContext) GetSelectedRef

func (self *ReflogCommitsContext) GetSelectedRef() types.Ref

func (*ReflogCommitsContext) ShowBranchHeadsInSubCommits added in v0.40.0

func (self *ReflogCommitsContext) ShowBranchHeadsInSubCommits() bool

type RemoteBranchesContext

func NewRemoteBranchesContext

func NewRemoteBranchesContext(
	c *ContextCommon,
) *RemoteBranchesContext

func (*RemoteBranchesContext) GetDiffTerminals added in v0.39.0

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

func (*RemoteBranchesContext) GetSelectedItemId

func (self *RemoteBranchesContext) GetSelectedItemId() string

func (*RemoteBranchesContext) GetSelectedRef

func (self *RemoteBranchesContext) GetSelectedRef() types.Ref

func (*RemoteBranchesContext) ShowBranchHeadsInSubCommits added in v0.40.0

func (self *RemoteBranchesContext) ShowBranchHeadsInSubCommits() bool

type RemotesContext

type RemotesContext struct {
	*FilteredListViewModel[*models.Remote]
	*ListContextTrait
}

func NewRemotesContext

func NewRemotesContext(c *ContextCommon) *RemotesContext

func (*RemotesContext) GetDiffTerminals added in v0.39.0

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

func (*RemotesContext) GetSelectedItemId

func (self *RemotesContext) GetSelectedItemId() string

type SearchTrait added in v0.39.0

type SearchTrait struct {
	// contains filtered or unexported fields
}

func NewSearchTrait added in v0.39.0

func NewSearchTrait(c *ContextCommon) *SearchTrait

func (*SearchTrait) ClearSearchString added in v0.39.0

func (self *SearchTrait) ClearSearchString()

func (*SearchTrait) GetSearchString added in v0.39.0

func (self *SearchTrait) GetSearchString() string

func (*SearchTrait) IsSearchableContext added in v0.39.0

func (self *SearchTrait) IsSearchableContext()

used for type switch

func (*SearchTrait) IsSearching added in v0.39.0

func (self *SearchTrait) IsSearching() bool

func (*SearchTrait) SetSearchString added in v0.39.0

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 added in v0.39.0

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

func (*StashContext) GetSelectedItemId

func (self *StashContext) GetSelectedItemId() 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 added in v0.39.0

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

func (*SubCommitsContext) GetLimitCommits added in v0.38.0

func (self *SubCommitsContext) GetLimitCommits() bool

func (*SubCommitsContext) GetSelectedItemId

func (self *SubCommitsContext) GetSelectedItemId() string

func (*SubCommitsContext) GetSelectedRef

func (self *SubCommitsContext) GetSelectedRef() types.Ref

func (*SubCommitsContext) SetLimitCommits added in v0.38.0

func (self *SubCommitsContext) SetLimitCommits(value bool)

func (*SubCommitsContext) Title

func (self *SubCommitsContext) Title() string

type SubCommitsViewModel

type SubCommitsViewModel struct {
	*ListViewModel[*models.Commit]
	// contains filtered or unexported fields
}

func (*SubCommitsViewModel) GetRef added in v0.38.0

func (self *SubCommitsViewModel) GetRef() types.Ref

func (*SubCommitsViewModel) GetShowBranchHeads added in v0.40.0

func (self *SubCommitsViewModel) GetShowBranchHeads() bool

func (*SubCommitsViewModel) SetRef added in v0.38.0

func (self *SubCommitsViewModel) SetRef(ref types.Ref)

func (*SubCommitsViewModel) SetShowBranchHeads added in v0.40.0

func (self *SubCommitsViewModel) SetShowBranchHeads(value bool)

type SubmodulesContext

type SubmodulesContext struct {
	*FilteredListViewModel[*models.SubmoduleConfig]
	*ListContextTrait
}

func NewSubmodulesContext

func NewSubmodulesContext(c *ContextCommon) *SubmodulesContext

func (*SubmodulesContext) GetSelectedItemId

func (self *SubmodulesContext) GetSelectedItemId() string

type SuggestionsContext

type SuggestionsContext struct {
	*ListViewModel[*types.Suggestion]
	*ListContextTrait

	State *SuggestionsContextState
}

func NewSuggestionsContext

func NewSuggestionsContext(
	c *ContextCommon,
) *SuggestionsContext

func (*SuggestionsContext) GetSelectedItemId

func (self *SuggestionsContext) GetSelectedItemId() string

func (*SuggestionsContext) RefreshSuggestions added in v0.39.0

func (self *SuggestionsContext) RefreshSuggestions()

func (*SuggestionsContext) SetSuggestions added in v0.39.0

func (self *SuggestionsContext) SetSuggestions(suggestions []*types.Suggestion)

type SuggestionsContextState added in v0.39.0

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 added in v0.36.0

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 added in v0.39.0

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

func (*TagsContext) GetSelectedItemId

func (self *TagsContext) GetSelectedItemId() string

func (*TagsContext) GetSelectedRef

func (self *TagsContext) GetSelectedRef() types.Ref

func (*TagsContext) ShowBranchHeadsInSubCommits added in v0.40.0

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

func (*WorkingTreeContext) GetSelectedItemId

func (self *WorkingTreeContext) GetSelectedItemId() string

type WorktreesContext added in v0.40.0

type WorktreesContext struct {
	*FilteredListViewModel[*models.Worktree]
	*ListContextTrait
}

func NewWorktreesContext added in v0.40.0

func NewWorktreesContext(c *ContextCommon) *WorktreesContext

func (*WorktreesContext) GetSelectedItemId added in v0.40.0

func (self *WorktreesContext) GetSelectedItemId() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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