1.3.0
π¦ Published to pub.dev: dart_tui 1.3.0
New components & helpers
Spring(bubbles/spring.dart) β harmonica-style damped-harmonic-oscillator for smooth eased motion of any scalar (progress, scroll, cursor). Pure math, no terminal I/O:Spring(fps:, frequency:, damping:).update(pos, vel, target)plusfpsToDelta().FileLog(log.dart) β append timestamped diagnostics to a file. Because a runningProgramowns stdout,print()corrupts the UI; write here andtail -finstead.FileLog.none()discards.- gum-style one-shot helpers (
gum.dart) βfilter()(interactive fuzzy picker),spin()(run a spinner while awaiting aFuture, returns its result), andpager()(scrollable viewer). Each takes aprogramOptionslist for headless testing. ListModelruntime mutation API βwithItems,appendItem,insertItem,removeItemAt,setItemAt,select, andselectedIndex; all clamp the cursor.- Readline / emacs editing keys for
TextInputModelandTextAreaModelβctrl+a/ctrl+e(home/end),ctrl+b/ctrl+f(char left/right),alt+β/alt+β(word motion), andctrl+w/alt+backspace(delete previous word).
Examples
Five new runnable examples (each with a VHS tape): spring, gum (filter/spin/pager), list_mutation, readline, and file_log.
Performance
Hot-path allocation and CPU reductions on the per-frame render and per-keystroke paths (all behaviour-preserving, covered by regression tests):
stripAnsifast-path (skip the regex when there is no escape) plus a single-grapheme width helper β the width/wrap/truncate/pad path no longer runs a regex per grapheme.ViewportModelreuses its wrapped lines across scrolling instead of re-wrapping every frame.AnsiRendererandCellRendererskip the grid rebuild / diff walk on identical frames; the redundant per-frame list copy is gone.ListModel.filteredItemsis memoised;TreeModelreuses its flattened node list on cursor-only changes.- The render throttle uses a precomputed frame budget and a monotonic
Stopwatch.
Fixes
- Prompts no longer hang on cancel.
promptSelect/promptConfirm/promptInputsetfinishedon Esc/Ctrl+C but never quit, and raw mode delivers Ctrl+C as a byte (not SIGINT) β so cancelling hung forever. They now quit cleanly and returnnull. The three prompt helpers also gained aprogramOptionsparameter for headless/scripted use.
Quality
- Test suite grown from 423 to 560+ cases; measured
lib/line coverage raised from ~67% to 92%. - New
make coverage [FLOOR=90]target and a CI coverage gate (Linux/macOS) that fails below the floor, honouring// coverage:ignore-*markers for genuinely-untestable code (Win32 FFI, raw-mode TTY, OS signals).