tui.input
tui.input ID PANE ROW [PLACEHOLDER] [LABEL] [SUBMIT]
Creates a single-line text input.
Parameters
PLACEHOLDER: grey text shown while empty.LABEL: text drawn before the field.SUBMIT: function called on Enter asSUBMIT ID TEXT: the widget id, then the current text.
Returns: 1 when ID or PANE is empty.
Notes
- The id lets one function serve several inputs:
case $1 in inp_name) ... ;; inp_mail) ... ;; esac. - Without
SUBMIT, an action set withtui.on_actionis called asACTION IDinstead. - The text is not cleared after submit. Clear it in
SUBMITwithtui.update ID "". - The input keeps focus after Enter by default; see
tui.input.retain. - Full editing keys (selection, word jumps, clipboard, undo): press
f1in the app, or seetui.action.text_keys.
Example
tui.input inp_cmd shell 0 "type a command" "> " run_cmd
run_cmd() { tui.output_append log "\$ $2"; tui.update "$1" ""; } # $1 = this input's id, $2 = the text
See also: tui.password, tui.textarea
