Help us shape the future of Go! Take the 2026 Go Developer Survey

destpicker

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package destpicker lists candidate revisions so the user can choose where changes move. The parent model loads the revisions, routes keys here while the picker is visible, and reads the highlighted entry back out on confirmation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

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

Model is the destination picker. Mutators take a pointer receiver, so a parent holding it by value must keep the same field rather than a copy.

func New

func New() Model

New returns a hidden picker with no revisions, so SetRevisions must run before Show.

func (Model) GetSelected

func (m Model) GetSelected() *jj.RevisionEntry

GetSelected returns a pointer into the revision slice, or nil when the list is empty. The pointer is invalidated by the next SetRevisions, so read what is needed before calling it.

func (*Model) Hide

func (m *Model) Hide()

Hide takes the picker off screen and leaves the revisions and cursor in place, so a later Show resumes on the same row.

func (*Model) IsVisible

func (m *Model) IsVisible() bool

IsVisible reports whether keys belong to the picker rather than the main view.

func (*Model) MoveDown

func (m *Model) MoveDown()

MoveDown moves the cursor one revision later in the list and stops at the last, without wrapping.

func (*Model) MoveUp

func (m *Model) MoveUp()

MoveUp moves the cursor one revision earlier in the list and stops at the first, without wrapping.

func (*Model) SetRevisions

func (m *Model) SetRevisions(revisions []jj.RevisionEntry)

SetRevisions replaces the candidate list, keeping the cursor where it is when the new list is long enough and falling back to the first row otherwise. The slice is retained, not copied.

func (*Model) Show

func (m *Model) Show()

Show reveals the picker. While it is visible the parent model routes every key here.

func (Model) View

func (m Model) View(width, height int) string

View centers the picker in a terminal of the given cell dimensions, scrolling a window of rows that keeps the cursor near the middle. It returns an empty string while hidden.

Jump to

Keyboard shortcuts

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