viewmodel

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileTreeViewModel added in v0.11.0

type FileTreeViewModel struct {
	ModelTree *filetree.FileTree
	ViewTree  *filetree.FileTree
	RefTrees  []*filetree.FileTree

	CollapseAll    bool
	ShowAttributes bool

	HiddenDiffTypes []bool
	TreeIndex       int

	Buffer bytes.Buffer
	// contains filtered or unexported fields
}

FileTreeViewModel holds the UI objects and data models for populating the right pane. Specifically the pane that shows selected layer or aggregate file ASCII tree.

func NewFileTreeViewModel

func NewFileTreeViewModel(tree *filetree.FileTree, refTrees []*filetree.FileTree, cache filetree.Comparer) (treeViewModel *FileTreeViewModel, err error)

NewFileTreeViewModel creates a new view object attached the global [gocui] screen object.

func (*FileTreeViewModel) ConstrainLayout added in v0.11.0

func (vm *FileTreeViewModel) ConstrainLayout()

func (*FileTreeViewModel) CurrentNode added in v0.13.0

func (vm *FileTreeViewModel) CurrentNode(filterRegex *regexp.Regexp) *filetree.FileNode

CursorLeft moves the cursor up until we reach the Parent Node or top of the tree

func (*FileTreeViewModel) CursorDown added in v0.11.0

func (vm *FileTreeViewModel) CursorDown() bool

doCursorDown performs the internal view's buffer adjustments on cursor down. Note: this is independent of the gocui buffer.

func (*FileTreeViewModel) CursorLeft added in v0.11.0

func (vm *FileTreeViewModel) CursorLeft(filterRegex *regexp.Regexp) error

CursorLeft moves the cursor up until we reach the Parent Node or top of the tree

func (*FileTreeViewModel) CursorRight added in v0.11.0

func (vm *FileTreeViewModel) CursorRight(filterRegex *regexp.Regexp) error

CursorRight descends into directory expanding it if needed

func (*FileTreeViewModel) CursorUp added in v0.11.0

func (vm *FileTreeViewModel) CursorUp() bool

doCursorUp performs the internal view's buffer adjustments on cursor up. Note: this is independent of the gocui buffer.

func (*FileTreeViewModel) ExpandLayout added in v0.11.0

func (vm *FileTreeViewModel) ExpandLayout()

func (*FileTreeViewModel) IsVisible added in v0.11.0

func (vm *FileTreeViewModel) IsVisible() bool

IsVisible indicates if the file tree view pane is currently initialized

func (*FileTreeViewModel) PageDown added in v0.11.0

func (vm *FileTreeViewModel) PageDown() error

PageDown moves to next page putting the cursor on top

func (*FileTreeViewModel) PageUp added in v0.11.0

func (vm *FileTreeViewModel) PageUp() error

PageUp moves to previous page putting the cursor on top

func (*FileTreeViewModel) Render added in v0.11.0

func (vm *FileTreeViewModel) Render() error

Render flushes the state objects (file tree) to the pane.

func (*FileTreeViewModel) ResetCursor added in v0.11.0

func (vm *FileTreeViewModel) ResetCursor()

ResetCursor moves the cursor back to the top of the buffer and translates to the top of the buffer.

func (*FileTreeViewModel) SetTreeByLayer added in v0.11.0

func (vm *FileTreeViewModel) SetTreeByLayer(bottomTreeStart, bottomTreeStop, topTreeStart, topTreeStop int) error

SetTreeByLayer populates the view model by stacking the indicated image layer file trees.

func (*FileTreeViewModel) Setup added in v0.11.0

func (vm *FileTreeViewModel) Setup(lowerBound, height int)

Setup initializes the UI concerns within the context of a global [gocui] view object.

func (*FileTreeViewModel) ToggleAttributes added in v0.11.0

func (vm *FileTreeViewModel) ToggleAttributes() error

ToggleCollapse will collapse/expand the selected FileNode.

func (*FileTreeViewModel) ToggleCollapse added in v0.11.0

func (vm *FileTreeViewModel) ToggleCollapse(filterRegex *regexp.Regexp) error

ToggleCollapse will collapse/expand the selected FileNode.

func (*FileTreeViewModel) ToggleCollapseAll added in v0.11.0

func (vm *FileTreeViewModel) ToggleCollapseAll() error

ToggleCollapseAll will collapse/expand the all directories.

func (*FileTreeViewModel) ToggleShowDiffType added in v0.11.0

func (vm *FileTreeViewModel) ToggleShowDiffType(diffType filetree.DiffType)

ToggleShowDiffType will show/hide the selected DiffType in the filetree pane.

func (*FileTreeViewModel) ToggleSortOrder added in v0.11.0

func (vm *FileTreeViewModel) ToggleSortOrder() error

ToggleSortOrder will toggle the sort order in which files are displayed

func (*FileTreeViewModel) Update added in v0.11.0

func (vm *FileTreeViewModel) Update(filterRegex *regexp.Regexp, width, height int) error

Update refreshes the state objects for future rendering.

type LayerCompareMode added in v0.9.2

type LayerCompareMode int
const (
	CompareSingleLayer LayerCompareMode = iota
	CompareAllLayers
)

type LayerSelection

type LayerSelection struct {
	Layer                                                      *image.Layer
	BottomTreeStart, BottomTreeStop, TopTreeStart, TopTreeStop int
}

type LayerSetState added in v0.9.2

type LayerSetState struct {
	LayerIndex        int
	Layers            []*image.Layer
	CompareMode       LayerCompareMode
	CompareStartIndex int
}

func NewLayerSetState added in v0.9.2

func NewLayerSetState(layers []*image.Layer, compareMode LayerCompareMode) *LayerSetState

func (*LayerSetState) GetCompareIndexes added in v0.9.2

func (state *LayerSetState) GetCompareIndexes() (bottomTreeStart, bottomTreeStop, topTreeStart, topTreeStop int)

getCompareIndexes determines the layer boundaries to use for comparison (based on the current compare mode)

Jump to

Keyboard shortcuts

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