Documentation
¶
Overview ¶
Package splitassign renders the modal that pairs each split tag with a destination, either an existing revision or a commit to create. The parent model fills it with tags and revisions, routes keys to it while it is visible, and reads the finished pairing back with GetDestinations.
Index ¶
- type DestinationSpec
- type DestinationType
- type Model
- func (m *Model) AssignNewCommitToCurrentTag(description string)
- func (m *Model) AssignNewCommitToTag(tag SplitTag, description string)
- func (m *Model) AssignRevisionToCurrentTag()
- func (m *Model) GetDestinations() map[SplitTag]*DestinationSpec
- func (m *Model) Hide()
- func (m *Model) IsVisible() bool
- func (m *Model) MoveDown()
- func (m *Model) MoveUp()
- func (m *Model) SetRevisions(revisions []jj.RevisionEntry)
- func (m *Model) SetTags(tags []SplitTag)
- func (m *Model) Show()
- func (m *Model) ToggleFocus()
- func (m *Model) View(width, _ int) string
- type SplitTag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DestinationSpec ¶
type DestinationSpec struct {
ChangeID string
Description string
Type DestinationType
}
DestinationSpec is where one tag's hunks land. ChangeID is empty for DestNewCommit, where Description becomes the message of the commit that gets created.
type DestinationType ¶
type DestinationType int
DestinationType separates an assignment that targets a revision that already exists from one that creates a commit.
const ( DestExistingRevision DestinationType = iota DestNewCommit )
Destinations a tag can be sent to. DestExistingRevision is the zero value, so a DestinationSpec that was never filled in reads as targeting an existing revision.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the two-panel assignment modal, tags on the left and candidate revisions on the right, with one cursor per panel. It owns the destination map for the whole split, so the parent model keeps a single instance alive across openings.
func New ¶
func New() Model
New returns a hidden modal with no tags, no revisions, and the tag panel focused.
func (*Model) AssignNewCommitToCurrentTag ¶
AssignNewCommitToCurrentTag sends the selected tag to a commit to be created with description. It does nothing when the tag cursor sits outside the list.
func (*Model) AssignNewCommitToTag ¶
AssignNewCommitToTag sends a named tag to a commit to be created with description, without regard to the cursor, and records the tag even when it is not in the modal's tag list.
func (*Model) AssignRevisionToCurrentTag ¶
func (m *Model) AssignRevisionToCurrentTag()
AssignRevisionToCurrentTag points the selected tag at the selected revision, replacing any earlier assignment. It does nothing when either cursor sits outside its list.
func (*Model) GetDestinations ¶
func (m *Model) GetDestinations() map[SplitTag]*DestinationSpec
GetDestinations returns the tag-to-destination map by reference, so later assignments are visible through a map the caller already holds. A tag the user never assigned is absent.
func (*Model) Hide ¶
func (m *Model) Hide()
Hide closes the modal, keeping the assignments made so far.
func (*Model) IsVisible ¶
IsVisible reports whether the modal is open, which is how the parent decides to route keys here.
func (*Model) MoveDown ¶
func (m *Model) MoveDown()
MoveDown moves the focused panel's cursor down one row, stopping at the last.
func (*Model) MoveUp ¶
func (m *Model) MoveUp()
MoveUp moves the focused panel's cursor up one row, stopping at the first.
func (*Model) SetRevisions ¶
func (m *Model) SetRevisions(revisions []jj.RevisionEntry)
SetRevisions replaces the candidate revisions and rewinds the revision cursor when it would sit past the end. Order is preserved because the caller decides which revisions are worth offering.
func (*Model) SetTags ¶
SetTags adopts tags as the tag list and sorts it ascending, which reorders the caller's slice in place. The tag cursor rewinds when it would sit past the end. Assignments are untouched, including any belonging to a tag that is no longer listed.
func (*Model) Show ¶
func (m *Model) Show()
Show opens the modal with the tag panel focused, whatever panel was focused when it last closed.
func (*Model) ToggleFocus ¶
func (m *Model) ToggleFocus()
ToggleFocus swaps the cursor between the tag panel and the revision panel.