viewmodel

package
v0.0.0-...-a37b07e Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2023 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 FileTree

type FileTree 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 *FileTree, err error)

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

func (*FileTree) ConstrainLayout

func (vm *FileTree) ConstrainLayout()

func (*FileTree) CursorDown

func (vm *FileTree) CursorDown() bool

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

func (*FileTree) CursorLeft

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

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

func (*FileTree) CursorRight

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

CursorRight descends into directory expanding it if needed

func (*FileTree) CursorUp

func (vm *FileTree) CursorUp() bool

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

func (*FileTree) ExpandLayout

func (vm *FileTree) ExpandLayout()

func (*FileTree) IsVisible

func (vm *FileTree) IsVisible() bool

IsVisible indicates if the file tree view pane is currently initialized

func (*FileTree) PageDown

func (vm *FileTree) PageDown() error

PageDown moves to next page putting the cursor on top

func (*FileTree) PageUp

func (vm *FileTree) PageUp() error

PageUp moves to previous page putting the cursor on top

func (*FileTree) Render

func (vm *FileTree) Render() error

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

func (*FileTree) ResetCursor

func (vm *FileTree) ResetCursor()

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

func (*FileTree) SetTreeByLayer

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

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

func (*FileTree) Setup

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

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

func (*FileTree) ToggleAttributes

func (vm *FileTree) ToggleAttributes() error

ToggleCollapse will collapse/expand the selected FileNode.

func (*FileTree) ToggleCollapse

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

ToggleCollapse will collapse/expand the selected FileNode.

func (*FileTree) ToggleCollapseAll

func (vm *FileTree) ToggleCollapseAll() error

ToggleCollapseAll will collapse/expand the all directories.

func (*FileTree) ToggleShowDiffType

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

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

func (*FileTree) Update

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

Update refreshes the state objects for future rendering.

type LayerCompareMode

type LayerCompareMode int
const (
	CompareSingleLayer LayerCompareMode = iota
	CompareAllLayers
)

type LayerSelection

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

type LayerSetState

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

func NewLayerSetState

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

func (*LayerSetState) GetCompareIndexes

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