context

package
v0.36.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GLOBAL_CONTEXT_KEY                   types.ContextKey = "global"
	STATUS_CONTEXT_KEY                   types.ContextKey = "status"
	FILES_CONTEXT_KEY                    types.ContextKey = "files"
	LOCAL_BRANCHES_CONTEXT_KEY           types.ContextKey = "localBranches"
	REMOTES_CONTEXT_KEY                  types.ContextKey = "remotes"
	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"
	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

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

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

func NewBasicViewModel

func NewBasicViewModel[T any](getModel func() []T) *BasicViewModel[T]

func (*BasicViewModel[T]) GetSelected

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

func (*BasicViewModel[T]) Len

func (self *BasicViewModel[T]) Len() int

type BranchesContext

type BranchesContext struct {
	*BasicViewModel[*models.Branch]
	*ListContextTrait
}

func NewBranchesContext

func NewBranchesContext(
	getModel func() []*models.Branch,
	view *gocui.View,
	getDisplayStrings func(startIdx int, length int) [][]string,

	onFocus func(types.OnFocusOpts) error,
	onRenderToMain func() error,
	onFocusLost func(opts types.OnFocusLostOpts) error,

	c *types.HelperCommon,
) *BranchesContext

func (*BranchesContext) GetSelectedItemId

func (self *BranchesContext) GetSelectedItemId() string

func (*BranchesContext) GetSelectedRef

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

type CommitFilesContext

func NewCommitFilesContext

func NewCommitFilesContext(
	getModel func() []*models.CommitFile,
	view *gocui.View,
	getDisplayStrings func(startIdx int, length int) [][]string,

	onFocus func(types.OnFocusOpts) error,
	onRenderToMain func() error,
	onFocusLost func(opts types.OnFocusLostOpts) error,

	c *types.HelperCommon,
) *CommitFilesContext

func (*CommitFilesContext) GetSelectedItemId

func (self *CommitFilesContext) GetSelectedItemId() string

type ConflictsViewModel added in v0.36.0

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

type ContextCallbackOpts

type ContextCallbackOpts struct {
	OnFocus        func(opts types.OnFocusOpts) error
	OnFocusLost    func(opts types.OnFocusLostOpts) error
	OnRender       func() error
	OnRenderToMain func() error
}

type ContextTree

type ContextTree struct {
	Global                      types.Context
	Status                      types.Context
	Files                       *WorkingTreeContext
	Menu                        *MenuContext
	Branches                    *BranchesContext
	Tags                        *TagsContext
	LocalCommits                *LocalCommitsContext
	CommitFiles                 *CommitFilesContext
	Remotes                     *RemotesContext
	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                types.Context
	CommitMessage               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 (*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 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) OnSearchSelect

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

type LocalCommitsContext

type LocalCommitsContext struct {
	*LocalCommitsViewModel
	*ViewportListContextTrait
}

func NewLocalCommitsContext

func NewLocalCommitsContext(
	getModel func() []*models.Commit,
	view *gocui.View,
	getDisplayStrings func(startIdx int, length int) [][]string,

	onFocus func(types.OnFocusOpts) error,
	onRenderToMain func() error,
	onFocusLost func(opts types.OnFocusLostOpts) error,

	c *types.HelperCommon,
) *LocalCommitsContext

func (*LocalCommitsContext) CanRebase

func (self *LocalCommitsContext) CanRebase() bool

func (*LocalCommitsContext) GetSelectedItemId

func (self *LocalCommitsContext) GetSelectedItemId() string

func (*LocalCommitsContext) GetSelectedRef

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

type LocalCommitsViewModel

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

func NewLocalCommitsViewModel

func NewLocalCommitsViewModel(getModel func() []*models.Commit, c *types.HelperCommon) *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
}

func NewMenuContext

func NewMenuContext(
	view *gocui.View,

	c *types.HelperCommon,
	getOptionsMap func() map[string]string,
	renderToDescriptionView func(string),
) *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 {
	*BasicViewModel[*types.MenuItem]
	// contains filtered or unexported fields
}

func NewMenuViewModel

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

TODO: move into presentation package

func (self *MenuViewModel) SetMenuItems(items []*types.MenuItem)

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(
	view *gocui.View,

	opts ContextCallbackOpts,

	c *types.HelperCommon,
	getOptionsMap func() map[string]string,
) *MergeConflictsContext

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

	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
	// contains filtered or unexported fields
}

func NewPatchExplorerContext added in v0.36.0

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

	onFocus func(types.OnFocusOpts) error,
	onFocusLost func(opts types.OnFocusLostOpts) error,
	getIncludedLineIndices func() []int,

	c *types.HelperCommon,
) *PatchExplorerContext

func (*PatchExplorerContext) Focus added in v0.36.0

func (self *PatchExplorerContext) Focus() error

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) 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 {
	*BasicViewModel[*models.Commit]
	*ListContextTrait
}

func NewReflogCommitsContext

func NewReflogCommitsContext(
	getModel func() []*models.Commit,
	view *gocui.View,
	getDisplayStrings func(startIdx int, length int) [][]string,

	onFocus func(types.OnFocusOpts) error,
	onRenderToMain func() error,
	onFocusLost func(opts types.OnFocusLostOpts) error,

	c *types.HelperCommon,
) *ReflogCommitsContext

func (*ReflogCommitsContext) CanRebase

func (self *ReflogCommitsContext) CanRebase() bool

func (*ReflogCommitsContext) GetCommits

func (self *ReflogCommitsContext) GetCommits() []*models.Commit

func (*ReflogCommitsContext) GetSelectedItemId

func (self *ReflogCommitsContext) GetSelectedItemId() string

func (*ReflogCommitsContext) GetSelectedRef

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

type RemoteBranchesContext

type RemoteBranchesContext struct {
	*BasicViewModel[*models.RemoteBranch]
	*ListContextTrait
	*DynamicTitleBuilder
}

func NewRemoteBranchesContext

func NewRemoteBranchesContext(
	getModel func() []*models.RemoteBranch,
	view *gocui.View,
	getDisplayStrings func(startIdx int, length int) [][]string,

	onFocus func(types.OnFocusOpts) error,
	onRenderToMain func() error,
	onFocusLost func(opts types.OnFocusLostOpts) error,

	c *types.HelperCommon,
) *RemoteBranchesContext

func (*RemoteBranchesContext) GetSelectedItemId

func (self *RemoteBranchesContext) GetSelectedItemId() string

func (*RemoteBranchesContext) GetSelectedRef

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

type RemotesContext

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

func NewRemotesContext

func NewRemotesContext(
	getModel func() []*models.Remote,
	view *gocui.View,
	getDisplayStrings func(startIdx int, length int) [][]string,

	onFocus func(types.OnFocusOpts) error,
	onRenderToMain func() error,
	onFocusLost func(opts types.OnFocusLostOpts) error,

	c *types.HelperCommon,
) *RemotesContext

func (*RemotesContext) GetSelectedItemId

func (self *RemotesContext) GetSelectedItemId() string

type SimpleContext

type SimpleContext struct {
	OnFocus     func(opts types.OnFocusOpts) error
	OnFocusLost func(opts types.OnFocusLostOpts) error
	OnRender    func() error
	// this is for pushing some content to the main view
	OnRenderToMain func() error

	*BaseContext
}

func NewSimpleContext

func NewSimpleContext(baseContext *BaseContext, opts ContextCallbackOpts) *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 {
	*BasicViewModel[*models.StashEntry]
	*ListContextTrait
}

func NewStashContext

func NewStashContext(
	getModel func() []*models.StashEntry,
	view *gocui.View,
	getDisplayStrings func(startIdx int, length int) [][]string,

	onFocus func(types.OnFocusOpts) error,
	onRenderToMain func() error,
	onFocusLost func(opts types.OnFocusLostOpts) error,

	c *types.HelperCommon,
) *StashContext

func (*StashContext) CanRebase

func (self *StashContext) CanRebase() bool

func (*StashContext) GetSelectedItemId

func (self *StashContext) GetSelectedItemId() string

func (*StashContext) GetSelectedRef

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

type SubCommitsContext

func NewSubCommitsContext

func NewSubCommitsContext(
	getModel func() []*models.Commit,
	view *gocui.View,
	getDisplayStrings func(startIdx int, length int) [][]string,

	onFocus func(types.OnFocusOpts) error,
	onRenderToMain func() error,
	onFocusLost func(opts types.OnFocusLostOpts) error,

	c *types.HelperCommon,
) *SubCommitsContext

func (*SubCommitsContext) CanRebase

func (self *SubCommitsContext) CanRebase() bool

func (*SubCommitsContext) GetCommits

func (self *SubCommitsContext) GetCommits() []*models.Commit

func (*SubCommitsContext) GetSelectedItemId

func (self *SubCommitsContext) GetSelectedItemId() string

func (*SubCommitsContext) GetSelectedRef

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

func (*SubCommitsContext) Title

func (self *SubCommitsContext) Title() string

type SubCommitsViewModel

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

func (*SubCommitsViewModel) SetRefName

func (self *SubCommitsViewModel) SetRefName(refName string)

type SubmodulesContext

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

func NewSubmodulesContext

func NewSubmodulesContext(
	getModel func() []*models.SubmoduleConfig,
	view *gocui.View,
	getDisplayStrings func(startIdx int, length int) [][]string,

	onFocus func(types.OnFocusOpts) error,
	onRenderToMain func() error,
	onFocusLost func(opts types.OnFocusLostOpts) error,

	c *types.HelperCommon,
) *SubmodulesContext

func (*SubmodulesContext) GetSelectedItemId

func (self *SubmodulesContext) GetSelectedItemId() string

type SuggestionsContext

type SuggestionsContext struct {
	*BasicViewModel[*types.Suggestion]
	*ListContextTrait
}

func NewSuggestionsContext

func NewSuggestionsContext(
	getModel func() []*types.Suggestion,
	view *gocui.View,
	getDisplayStrings func(startIdx int, length int) [][]string,

	onFocus func(types.OnFocusOpts) error,
	onRenderToMain func() error,
	onFocusLost func(opts types.OnFocusLostOpts) error,

	c *types.HelperCommon,
) *SuggestionsContext

func (*SuggestionsContext) GetSelectedItemId

func (self *SuggestionsContext) GetSelectedItemId() string

type TabView added in v0.36.0

type TabView struct {
	Tab      string
	ViewName string
}

type TagsContext

type TagsContext struct {
	*BasicViewModel[*models.Tag]
	*ListContextTrait
}

func NewTagsContext

func NewTagsContext(
	getModel func() []*models.Tag,
	view *gocui.View,
	getDisplayStrings func(startIdx int, length int) [][]string,

	onFocus func(types.OnFocusOpts) error,
	onRenderToMain func() error,
	onFocusLost func(opts types.OnFocusLostOpts) error,

	c *types.HelperCommon,
) *TagsContext

func (*TagsContext) GetSelectedItemId

func (self *TagsContext) GetSelectedItemId() string

func (*TagsContext) GetSelectedRef

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

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 ViewportListContextTrait

type ViewportListContextTrait struct {
	*ListContextTrait
}

func (*ViewportListContextTrait) FocusLine

func (self *ViewportListContextTrait) FocusLine()

type WorkingTreeContext

type WorkingTreeContext struct {
	*filetree.FileTreeViewModel
	*ListContextTrait
}

func NewWorkingTreeContext

func NewWorkingTreeContext(
	getModel func() []*models.File,
	view *gocui.View,
	getDisplayStrings func(startIdx int, length int) [][]string,

	onFocus func(types.OnFocusOpts) error,
	onRenderToMain func() error,
	onFocusLost func(opts types.OnFocusLostOpts) error,

	c *types.HelperCommon,
) *WorkingTreeContext

func (*WorkingTreeContext) GetSelectedItemId

func (self *WorkingTreeContext) GetSelectedItemId() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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