Documentation
¶
Overview ¶
Package tui is the root of the module github.com/stokaro/kc/tui: the parts of a two-panel terminal program in the style of Midnight Commander, built on Bubble Tea v2.
kc's panels, function key bar, menu bar, dialogs, viewer, embedded shell and the screen that holds them moved into this module one package at a time: the table, the panel and its list widget, the dialog widgets and the dialog stack, the menu bar, the function key bar, the toast line, the viewer, the embedded shell, the two-panel screen and the parts they build on. The module imports nothing from kc, Kubernetes or controller-runtime, and a test in this package fails when it does.
The packages:
- table: a table over a long list that reads only the rows on screen.
- dialog: the widgets and the key handling of mc's dialogs, and the question, text input and confirmation dialogs.
- modal: the dialog window, the stack of open dialogs and mc's Esc handling.
- menubar: the F9 pull-down menu bar.
- keys: the function key bar, the Esc and C-x prefixes, key names in mc notation and a key map.
- toast: the bottom line toast, the busy marker and the message log.
- viewer: the F3 text viewer, for text in memory and for paged files.
- help: the F1 help, a book of linked Markdown pages with search.
- pagedfile: block-wise reading of files too large for memory.
- overlay: one block of terminal text drawn over another.
- styles: the colors and styles of the mc look.
- skin: panel palettes from YAML skin files, and label color rules.
- kittygfx: images through the Unicode placeholders of the Kitty graphics protocol.
- panel: one panel: the row source a program implements, the widget contract, and the panel's frame, modes and quick search.
- panel/list: the list widget that draws a folder through the table.
- panel/reload: loading and refreshing panel content in the background.
- nav: the stack of folders a panel has entered, a walk along row IDs, and a history of places.
- shell: the embedded subshell behind C-o, with the shell line, the status of its commands and its restarts, and handing the terminal to another program.
- shell/hook: the startup scripts that make a shell report the exit status of each command.
- app: the two-panel screen, with the focus, mc's order of key handling, the menu bar and the dialogs over the panels, and the messages that reach their owner behind a dialog.
- cmd/bubbleheadless: a headless terminal driver for tests and screenshots.
- examples/files: a two-panel file browser built only from these packages.
Versions are tags of the form tui/vX.Y.Z, and the changelog is CHANGELOG.md next to this file. Before v1, a minor version may change the API incompatibly.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package app is the two-panel screen of an mc-style program: the menu bar row, two panels side by side, the shell line and the function key bar, with the F9 menu bar, the stack of dialogs and the full-screen shell over them.
|
Package app is the two-panel screen of an mc-style program: the menu bar row, two panels side by side, the shell line and the function key bar, with the F9 menu bar, the stack of dialogs and the full-screen shell over them. |
|
cmd
|
|
|
bubbleheadless
command
Command bubbleheadless runs a terminal program without a real terminal and drives it with commands read from standard input.
|
Command bubbleheadless runs a terminal program without a real terminal and drives it with commands read from standard input. |
|
Package dialog draws the widgets of Midnight Commander's dialogs and runs their keys: lines of text, input lines, check boxes, separator rules and a row of push buttons, with the default button drawn "[< OK >]".
|
Package dialog draws the widgets of Midnight Commander's dialogs and runs their keys: lines of text, input lines, check boxes, separator rules and a row of push buttons, with the default button drawn "[< OK >]". |
|
examples
|
|
|
files
command
Command files is a two-panel file browser in the style of Midnight Commander, built only from the packages of this module.
|
Command files is a two-panel file browser in the style of Midnight Commander, built only from the packages of this module. |
|
Package help shows a book of Markdown pages in a window, as the F1 help of Midnight Commander does.
|
Package help shows a book of Markdown pages in a window, as the F1 help of Midnight Commander does. |
|
Package keys holds the key handling of mc's screens that a program shares between its panels, viewers and dialogs: the function key bar, the Esc and C-x prefixes, Meta digits as function keys, key names in mc notation, and a key map that binds those names.
|
Package keys holds the key handling of mc's screens that a program shares between its panels, viewers and dialogs: the function key bar, the Esc and C-x prefixes, Meta digits as function keys, key names in mc notation, and a key map that binds those names. |
|
Package kittygfx shows images with the Unicode placeholders of the Kitty graphics protocol: an image is sent once, as a virtual placement, and the screen shows it through ordinary text cells, the character U+10EEEE with diacritics for its row and column and the foreground color for its image ID.
|
Package kittygfx shows images with the Unicode placeholders of the Kitty graphics protocol: an image is sent once, as a virtual placement, and the screen shows it through ordinary text cells, the character U+10EEEE with diacritics for its row and column and the foreground color for its image ID. |
|
Package menubar implements a pull-down menu bar like the one Midnight Commander opens with F9: a one-line bar of menu titles on the top screen row and a framed drop-down under the selected title.
|
Package menubar implements a pull-down menu bar like the one Midnight Commander opens with F9: a one-line bar of menu titles on the top screen row and a framed drop-down under the selected title. |
|
Package modal is the dialog layer of an mc-style screen: the dialog window with its frame, shadow and key bar, the stack of open dialogs, mc's Esc handling, and the fit of a window over the panel it belongs to.
|
Package modal is the dialog layer of an mc-style screen: the dialog window with its frame, shadow and key bar, the stack of open dialogs, mc's Esc handling, and the fit of a window over the panel it belongs to. |
|
Package nav moves a panel through folders: the stack of folders it has entered, a walk along row IDs, and the history of places it has been.
|
Package nav moves a panel through folders: the stack of folders it has entered, a walk along row IDs, and the history of places it has been. |
|
Package overlay draws one block of terminal text over another, the way a dialog covers the panels behind it.
|
Package overlay draws one block of terminal text over another, the way a dialog covers the panels behind it. |
|
Package pagedfile reads a text file that is too large to hold in memory, one block at a time, so that a viewer can show any part of it without reading the rest.
|
Package pagedfile reads a text file that is too large to hold in memory, one block at a time, so that a viewer can show any part of it without reading the rest. |
|
Package panel holds one panel of a two-panel program: the row source a program implements for its data, the contract of what a panel shows, and the Panel with its frame, modes and quick search.
|
Package panel holds one panel of a two-panel program: the row source a program implements for its data, the contract of what a panel shows, and the Panel with its frame, modes and quick search. |
|
list
Package list is the list widget of a panel: it draws a panel.Folder through a table.BigTable that reads only the rows on screen.
|
Package list is the list widget of a panel: it draws a panel.Folder through a table.BigTable that reads only the rows on screen. |
|
reload
Package reload loads panel content in the background and refreshes it.
|
Package reload loads panel content in the background and refreshes it. |
|
Package shell is the embedded subshell of a two-panel program, as behind C-o in Midnight Commander: the user's $SHELL on a pseudo-terminal, drawn by a terminal emulator either full screen or as the one shell line under the panels.
|
Package shell is the embedded subshell of a two-panel program, as behind C-o in Midnight Commander: the user's $SHELL on a pseudo-terminal, drawn by a terminal emulator either full screen or as the one shell line under the panels. |
|
hook
Package hook makes a shell that a terminal program starts report the exit status of each command.
|
Package hook makes a shell that a terminal program starts report the exit status of each command. |
|
Package skin reads panel skins and label color rules.
|
Package skin reads panel skins and label color rules. |
|
Package styles holds the colors and lipgloss styles of the Midnight Commander look: white on blue panels with a cyan cursor row, black on light gray dialogs, and a function key bar of black key numbers and cyan labels.
|
Package styles holds the colors and lipgloss styles of the Midnight Commander look: white on blue panels with a cyan cursor row, black on light gray dialogs, and a function key bar of black key numbers and cyan labels. |
|
Package table shows a long list as a table that reads only the rows on screen, for the panels of a two-panel program.
|
Package table shows a long list as a table that reads only the rows on screen, for the panels of a two-panel program. |
|
demo
command
Command demo shows two tables over the same 1,000 rows of made-up data, side by side, with a status column that changes every second.
|
Command demo shows two tables over the same 1,000 rows of made-up data, side by side, with a status column that changes every second. |
|
Package toast holds the messages of an mc-style screen's bottom lines: the toast, the busy marker and the message log behind them.
|
Package toast holds the messages of an mc-style screen's bottom lines: the toast, the busy marker and the message log behind them. |
|
Package viewer shows text in a panel or a window, like Midnight Commander's F3 viewer: scrolling, syntax highlighting, line wrap, a search dialog and selection with the mouse.
|
Package viewer shows text in a panel or a window, like Midnight Commander's F3 viewer: scrolling, syntax highlighting, line wrap, a search dialog and selection with the mouse. |