Documentation
¶
Overview ¶
Package edit is the terminal UI's config editing (design/tui.md "Forms and dialogs"): `:config` runs the user's editor on the config text and saves it through the API with its revision, and the server, new server and settings forms are overlays over a dimmed screen. Everything goes through the daemon's API, so it works with --on, and the daemon validates: its errors are shown under the fields they name.
Index ¶
- type Editor
- func (e *Editor) Config(env *ui.Env, gen int) tea.Cmd
- func (e *Editor) EditServer(env *ui.Env, name string) tea.Cmd
- func (e *Editor) Hints() [][2]string
- func (e *Editor) Key(env *ui.Env, msg tea.KeyPressMsg) tea.Cmd
- func (e *Editor) Mouse(env *ui.Env, msg tea.MouseMsg) tea.Cmd
- func (e *Editor) NewServer(env *ui.Env, root string) tea.Cmd
- func (e *Editor) Open() bool
- func (e *Editor) Settings(env *ui.Env) tea.Cmd
- func (e *Editor) Update(env *ui.Env, msg tea.Msg) (tea.Cmd, bool)
- func (e *Editor) View(env *ui.Env, screen string, w, h int) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Editor ¶
type Editor struct {
// contains filtered or unexported fields
}
Editor is the root model's handle on config editing: at most one overlay (a loading line, the proposals or a form) and the `:config` run.
func (*Editor) Config ¶
Config starts `:config`: the config text and revision come from the daemon (so it works with --on too), the user's editor runs on a private copy, and the result goes back with the original revision. The file on disk is never edited here. A new run replaces one whose dialog was cancelled. gen is the root's session generation.
func (*Editor) EditServer ¶
EditServer opens the form of a server's config entry.
func (*Editor) Hints ¶
Hints are the footer's key hints while the overlay is open: none for the form and the proposals picker, which draw theirs in their box, and the way out while the overlay loads.
func (*Editor) Mouse ¶
Mouse handles the mouse while the overlay is open: a click on a field or a proposal selects it (a second click on a proposal opens it), the wheel moves the cursor.
func (*Editor) NewServer ¶
NewServer opens the scan proposals of root ("" for the projects folder), from which a form opens prefilled or empty.