notebook/tui
src/notebook/tui.tur
command-mode terminal UI for .tur.md notebooks.
defn
tui-opts-make
(tui-opts-make [color : int cell_width : int scrollback : int keybindings_file : cstr])
build notebook/tui options.
defn
default-tui-opts
(default-tui-opts)
default options for the command-mode notebook TUI.
defn
tui-opts-free
(tui-opts-free [opts : int])
release a TuiOpts. Safe on 0.
defn
tui-run
(tui-run [path : cstr opts : int])
parse a notebook file and launch the command-mode TUI.
defn
tui-run-nodes
(tui-run-nodes [nodes : int opts : int])
launch the command-mode TUI with an already-parsed node list.
Internal definitions
__tui-nil-value__tui-cons__tui-list-nil?__tui-head__tui-tail__tui-ok__tui-err__tui-result-ok?__tui-result-ok-val__tui-result-err-val__tui-cstr-empty?__tui-cstr-eq?__tui-str-concat__tui-cstr-free-- release an owned string. Safe on 0.__tui-own-- copy a borrowed string so a concat can consume it. Status__tui-concat-owned-- concatenate two owned strings, releasing both.__tui-cstr-drop-last__tui-cstr-contains-ci?__tui-int->cstr__tui-opts-color__tui-opts-cell-width__tui-opts-scrollback__tui-opts-keybindings-file__tui-node-cell-make__tui-copy-cell-- a duplicate of `cell` under a new id and source.__tui-current-cell__tui-cells-have-id?__tui-fresh-cell-id__tui-append-node-- The four node-list editors below splice the existing spine rather than__tui-insert-node-before-- splice new_node in ahead of the cell node with__tui-insert-node-after-- splice new_node in behind the cell node with__tui-delete-node-pair-- unlink the cell node with target_id. Returns a__tui-blank-cell-- a new empty cell with the next free id. cell-make__tui-cells-from-nodes-rev__tui-reverse-- reverse a list, consuming its cons cells.__tui-list-length__tui-zero-list__tui-list-nth__tui-list-set-- set the idx-th element, extending with zeros if short.__tui-concat-lists__tui-write-file__tui-state-make__tui-cons-free-- free one cons cell, leaving its head and tail alone.__tui-spine-free-- free a cons spine, leaving the heads alone.__tui-state-free-- release the TUI state and everything it owns: its two__tui-state-free-shell-- free the state's own strings and struct.__tui-void-- void no-op, so a cleanup-only `if` has void on both arms.__tui-box-free-- release a Result box after taking its payload out.__tui-state-cells__tui-state-outputs__tui-state-set-outputs__tui-state-set-cells__tui-state-set-nodes__tui-state-set-cell-count__tui-state-set-focus__tui-state-focus__tui-state-cell-count__tui-state-session__tui-state-bindings__tui-state-path__tui-state-nodes__tui-state-status__tui-state-set-status__tui-set-status-owned-- set the status from a string the caller hands__tui-state-pending-effect__tui-state-set-pending-effect__tui-state-exit-code__tui-state-set-quit__tui-state-dirty__tui-state-set-dirty__tui-state-search-query__tui-state-set-search-query__tui-state-help-visible__tui-state-set-help-visible__tui-state-clipboard__tui-state-set-clipboard__tui-state-quit-confirm__tui-state-set-quit-confirm__tui-state-quit?__tui-binding-action__tui-binding-has-prefix__tui-output-message-- build the status line for a just-run cell. The__tui-cell-matches-query?__tui-wrap-index__tui-find-match__tui-read-search-query__tui-search__tui-rebuild-state-- swap in a new node list and recompute everything__tui-edit-source__tui-run-current__tui-run-all__tui-save__tui-edit-current__tui-add-cell__tui-delete-current__tui-paste-cell__tui-request-quit__tui-search-prompt__tui-search-next__tui-search-prev__tui-toggle-help__tui-toggle-output__tui-apply-effect__tui-render__tui-handle-key-- process one keystroke. `pending` is borrowed from the__tui-loop-- read keys until the state asks to quit. Each iteration owns__tui-load-bindings-- the built-in bindings, with a file's overrides in__tui-run-with-path