views

package
v0.0.0-...-6bb53db Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Binary

type Binary struct {
	io.ReadSeekCloser
	// contains filtered or unexported fields
}

Binary manages the base logic of rendering binary data.

func NewBinary

func NewBinary(rdr io.ReadSeekCloser) (*Binary, error)

NewBinary prepares binary data for rendering.

func (Binary) Footer

func (v Binary) Footer(cursor, width int, baseStyle lipgloss.Style) string

Footer formats the footer using the base style and view width.

func (Binary) Len

func (v Binary) Len(width int) int

Len returns the number of lines of text.

func (Binary) Render

func (v Binary) Render(i, width int, baseStyle lipgloss.Style) string

Render formats the line at position i using the base style and view width.

type FS

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

FS is a viewer for a fs.FS.

func (FS) At

func (fsv FS) At(i int) fs.DirEntry

At returns the directory entry at position i.

func (FS) Close

func (fsv FS) Close() error

Close closes the viewer, if necessary.

func (FS) FS

func (fsv FS) FS() fs.FS

FS returns the file system being viewed.

func (FS) Folder

func (fsv FS) Folder() string

Folder returns the current folder in the file system.

func (FS) Footer

func (fsv FS) Footer(i, width int, baseStyle lipgloss.Style) string

Footer formats the footer using the base style and view width.

func (*FS) Init

func (fsv *FS) Init(fsys fs.FS, root, folder string) error

Init initializes a new file system view.

func (FS) Len

func (fsv FS) Len(width int) int

Len returns the number of file entries.

func (FS) Render

func (fsv FS) Render(i, width int, baseStyle lipgloss.Style) string

Render formats the line at position i using the base style and view width.

func (FS) Root

func (fsv FS) Root() string

Root returns the name of the root file system.

func (*FS) Select

func (fsv *FS) Select(i int, b bool)

Select sets the selected flag at position i to b.

func (FS) Selected

func (fsv FS) Selected(i int) bool

Selected returns whether the entry at position i is selected.

func (FS) Title

func (fsv FS) Title() string

Title returns the full name of the current folder.

func (*FS) ToggleSelect

func (fsv *FS) ToggleSelect(i int)

ToggleSelect toggles the selected flag at position i.

type Text

type Text []string

Text manages the base logic of the cursor position and pagination of a string of text.

func NewText

func NewText(t string, fpath string) Text

NewText expands tabs and splits the string into a slice of lines.

func (Text) Close

func (v Text) Close() error

Close closes the viewer, if necessary.

func (Text) Footer

func (v Text) Footer(cursor, width int, baseStyle lipgloss.Style) string

Footer formats the footer using the base style and view width.

func (Text) Len

func (v Text) Len(width int) int

Len returns the number of lines of text.

func (Text) Render

func (v Text) Render(i, width int, baseStyle lipgloss.Style) string

Render formats the line at position i using the base style and view width.

Jump to

Keyboard shortcuts

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