model

package
v0.0.0-...-91bf553 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CtrlKey

func CtrlKey(key rune) tea.KeyMsg

func KeyPress

func KeyPress(key rune) tea.KeyMsg

KeyPress creates a tea.KeyMsg for single character keys

func SpecialKey

func SpecialKey(keyType tea.KeyType) tea.KeyMsg

SpecialKey creates a tea.KeyMsg for special keys

func TestChanges

func TestChanges() []diff.FileChange

TestChanges creates sample file changes for testing

Types

type DestinationSpec

type DestinationSpec struct {
	Type        DestinationType
	ChangeID    string
	Description string
}

type DestinationType

type DestinationType int
const (
	DestExistingRevision DestinationType = iota
	DestNewCommit
)

type FileSelection

type FileSelection struct {
	Hunks map[int]*HunkSelection
}

type FocusedPanel

type FocusedPanel int
const (
	PanelFileList FocusedPanel = iota
	PanelDiffView
)

type HunkSelection

type HunkSelection struct {
	WholeHunk     bool
	SelectedLines map[int]bool
}

type Model

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

func NewModel

func NewModel(client *jj.Client, source, destination string, mode OperatingMode, cfg config.Config) (Model, error)

func NewModelWithSource

func NewModelWithSource(source diff.DiffSource, client *jj.Client, destination string, mode OperatingMode, cfg config.Config) (Model, error)

func NewTestModel

func NewTestModel(t *testing.T, mode OperatingMode) Model

TestModel creates a model with mock client for testing

func Update

func Update(t *testing.T, m Model, msg tea.Msg) Model

Update is a helper that processes a message and returns the updated model

func UpdateWithCmd

func UpdateWithCmd(t *testing.T, m Model, msg tea.Msg) Model

UpdateWithCmd processes a message and executes any returned command synchronously

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Update

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

func (Model) View

func (m Model) View() string

func (Model) WithChanges

func (m Model) WithChanges(changes []diff.FileChange) Model

WithChanges sets up the model with test file changes

func (Model) WithDestination

func (m Model) WithDestination(dest string) Model

WithDestination sets a destination for the model

type ModelAssertion

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

ModelAssertion provides fluent assertions on model state

func Assert

func Assert(t *testing.T, m Model) *ModelAssertion

Assert creates a new ModelAssertion for fluent testing

func (*ModelAssertion) DestPickerIsNotVisible

func (a *ModelAssertion) DestPickerIsNotVisible() *ModelAssertion

func (*ModelAssertion) DestPickerIsVisible

func (a *ModelAssertion) DestPickerIsVisible() *ModelAssertion

func (*ModelAssertion) FileFinderIsNotVisible

func (a *ModelAssertion) FileFinderIsNotVisible() *ModelAssertion

func (*ModelAssertion) FileFinderIsVisible

func (a *ModelAssertion) FileFinderIsVisible() *ModelAssertion

func (*ModelAssertion) FileListFilterModeDisabled

func (a *ModelAssertion) FileListFilterModeDisabled() *ModelAssertion

func (*ModelAssertion) FileListFilterModeEnabled

func (a *ModelAssertion) FileListFilterModeEnabled() *ModelAssertion

func (*ModelAssertion) FocusedPanelIs

func (a *ModelAssertion) FocusedPanelIs(panel FocusedPanel) *ModelAssertion

func (*ModelAssertion) HasChanges

func (a *ModelAssertion) HasChanges(count int) *ModelAssertion

func (*ModelAssertion) HasDestination

func (a *ModelAssertion) HasDestination(dest string) *ModelAssertion

func (*ModelAssertion) HasError

func (a *ModelAssertion) HasError() *ModelAssertion

func (*ModelAssertion) HasHunkNotSelected

func (a *ModelAssertion) HasHunkNotSelected(filePath string, hunkIdx int) *ModelAssertion

func (*ModelAssertion) HasHunkSelected

func (a *ModelAssertion) HasHunkSelected(filePath string, hunkIdx int) *ModelAssertion

func (*ModelAssertion) HasLineCursor

func (a *ModelAssertion) HasLineCursor(position int) *ModelAssertion

func (*ModelAssertion) HasNoError

func (a *ModelAssertion) HasNoError() *ModelAssertion

func (*ModelAssertion) HasSelectedFile

func (a *ModelAssertion) HasSelectedFile(idx int) *ModelAssertion

func (*ModelAssertion) HasSelectedHunk

func (a *ModelAssertion) HasSelectedHunk(idx int) *ModelAssertion

func (*ModelAssertion) HelpIsNotVisible

func (a *ModelAssertion) HelpIsNotVisible() *ModelAssertion

func (*ModelAssertion) HelpIsVisible

func (a *ModelAssertion) HelpIsVisible() *ModelAssertion

func (*ModelAssertion) IsInVisualMode

func (a *ModelAssertion) IsInVisualMode() *ModelAssertion

func (*ModelAssertion) IsNotInVisualMode

func (a *ModelAssertion) IsNotInVisualMode() *ModelAssertion

func (*ModelAssertion) ModeIs

func (a *ModelAssertion) ModeIs(mode OperatingMode) *ModelAssertion

func (*ModelAssertion) NoModalsVisible

func (a *ModelAssertion) NoModalsVisible() *ModelAssertion

func (*ModelAssertion) SearchIsNotVisible

func (a *ModelAssertion) SearchIsNotVisible() *ModelAssertion

func (*ModelAssertion) SearchIsVisible

func (a *ModelAssertion) SearchIsVisible() *ModelAssertion

type MultiSplitState

type MultiSplitState struct {
	Active       bool
	Selections   map[SplitTag]*SelectionState
	Destinations map[SplitTag]*DestinationSpec
	CurrentTag   SplitTag
}

func NewMultiSplitState

func NewMultiSplitState() *MultiSplitState

type OperatingMode

type OperatingMode int
const (
	ModeBrowse OperatingMode = iota
	ModeInteractive
	ModeDiffEditor
)

type SelectionState

type SelectionState struct {
	Files map[string]*FileSelection
}

func NewSelectionState

func NewSelectionState() *SelectionState

func (*SelectionState) HasPartialSelection

func (s *SelectionState) HasPartialSelection(filePath string, hunkIdx int) bool

func (*SelectionState) IsHunkSelected

func (s *SelectionState) IsHunkSelected(filePath string, hunkIdx int) bool

func (*SelectionState) IsLineSelected

func (s *SelectionState) IsLineSelected(filePath string, hunkIdx, lineIdx int) bool

func (*SelectionState) SelectLineRange

func (s *SelectionState) SelectLineRange(filePath string, hunkIdx, startLine, endLine int)

func (*SelectionState) ToggleHunk

func (s *SelectionState) ToggleHunk(filePath string, hunkIdx int)

func (*SelectionState) ToggleLine

func (s *SelectionState) ToggleLine(filePath string, hunkIdx, lineIdx int)

type SplitTag

type SplitTag rune

Jump to

Keyboard shortcuts

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