display

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeNormal  EditingMode = "NORMAL"
	ModeInsert  EditingMode = "INSERT"
	ModeVisual  EditingMode = "VISUAL"
	ModeReplace EditingMode = "REPLACE"
	ModeCommand EditingMode = "COMMAND"

	ActiveColumnHex ActiveColumn = iota
	ActiveColumnAscii
)

Variables

View Source
var (
	EmptyReadSeeker = io.ReadSeeker(bytes.NewReader([]byte{}))
)

Functions

func CalculateViewSize

func CalculateViewSize(width, height int) (ncols, nrows int)

CalculateViewSize calculates the number of rows and columns that can fit in the given width and height.

func MakeStyle

func MakeStyle(primary bool, isEditing bool, activeRegions []core.Region) lipgloss.Style

func TeaMsgCmd

func TeaMsgCmd(msg tea.Msg) tea.Cmd

Types

type ActiveColumn

type ActiveColumn int

type BufferSavedMsg

type BufferSavedMsg struct {
	FileName     string
	BytesWritten int64
	Quit         bool
}

type EditingMode

type EditingMode string

type Model

type Model struct {
	ResponsiveCols bool
	// contains filtered or unexported fields
}

func HandleKeypressCommand

func HandleKeypressCommand(m Model, msg tea.KeyMsg) (Model, tea.Cmd)

func HandleKeypressInsert

func HandleKeypressInsert(m Model, msg tea.KeyMsg) (Model, tea.Cmd)

func HandleKeypressNormal

func HandleKeypressNormal(m Model, msg tea.KeyMsg) (Model, tea.Cmd)

func HandleKeypressVisual

func HandleKeypressVisual(m Model, msg tea.KeyMsg) (Model, tea.Cmd)

func NewModel

func NewModel() Model

func (*Model) GetViewBounds

func (m *Model) GetViewBounds() (int64, int64)

GetViewBounds returns the start and end positions of the view.

func (Model) Init

func (m Model) Init() tea.Cmd

func (*Model) LoadFile

func (m *Model) LoadFile(name string) error

func (*Model) MoveCursor

func (m *Model) MoveCursor(amount int64)

MoveCursor moves the cursor by the given amount.

func (Model) RenderHexView

func (m Model) RenderHexView() (string, error)

RenderHexView renders the hex dump.

func (Model) RenderStatus

func (m Model) RenderStatus() string

RenderStatus renders the status bar.

func (*Model) ScrollToCursor

func (m *Model) ScrollToCursor()

ScrollToCursor scrolls the view so that the cursor is visible.

func (*Model) SetCursor

func (m *Model) SetCursor(pos int64)

SetCursor sets the cursor position.

func (*Model) SetMode

func (m *Model) SetMode(mode EditingMode)

SetMode sets the editing mode.

func (*Model) StatusMessage

func (m *Model) StatusMessage(msg string, isError bool)

StatusMessage sets the status message.

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Model) View

func (m Model) View() string

type StatusTextMsg

type StatusTextMsg struct {
	Text  string
	Error bool
}

Jump to

Keyboard shortcuts

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