BB.TUI.Panels.CommandEdit (BB.TUI v0.1.0)

Copy Markdown View Source

Argument-edit popup for the commands panel.

Floats above the dashboard while the user edits the arguments of the selected command. Each declared argument renders as a row showing the current value (string buffer) and type hint; the focused row gets a prefix and a cursor. A hint footer describes the edit-mode keys.

Pure function — takes state, returns a Popup widget struct.

Summary

Functions

Renders the edit popup for the selected command, or nil when the selected command has no arguments. The caller should only invoke this when state.commands.edit_mode? is true.

Functions

render(state)

@spec render(BB.TUI.State.t()) :: struct() | nil

Renders the edit popup for the selected command, or nil when the selected command has no arguments. The caller should only invoke this when state.commands.edit_mode? is true.

Examples

iex> cmd = %{name: :move, arguments: [%{name: :angle, type: "float", default: 0.0}]}
iex> state = %BB.TUI.State{
...>   commands: %BB.TUI.State.Commands{
...>     available: [cmd],
...>     selected: 0,
...>     edit_mode?: true,
...>     focused_arg: 0
...>   }
...> }
iex> %ExRatatui.Widgets.Popup{} = BB.TUI.Panels.CommandEdit.render(state)

iex> state = %BB.TUI.State{commands: %BB.TUI.State.Commands{available: [], selected: 0}}
iex> BB.TUI.Panels.CommandEdit.render(state)
nil