Versioning & releases
glyphora is pre-1.0. Patch releases preserve public APIs; minor releases may make
breaking changes as the application layer matures. tui-core remains the stability
anchor, but minor-release source migrations there also apply: 0.21.0 replaces
public coordinate and RGB tuples with named records.
Pin an exact version in applications and review release notes before moving between minor versions.
Current coordinates
All publishable modules in this checkout share one synchronized version under com.worxbend:
// Mill
def mvnDeps = Seq(mvn"com.worxbend::tui-dsl:0.21.0")
// sbt
libraryDependencies += "com.worxbend" %% "tui-dsl" % "0.21.0"
Applications normally need only tui-dsl. Lower-tier artifacts are tui-core,
tui-terminal, tui-widgets, tui-runtime, and tui-macros; tui-test carries the
headless test harness and belongs in the test configuration only.
Version 0.21.0 is released from the v0.21.0 tag. Its Publish workflow validates the
exact tag commit before uploading to Maven Central under com.worxbend (see
Release process); check that workflow before expecting a newly
pushed tag to resolve. Central keeps earlier releases, so builds pinned to 0.20.0
keep resolving.
Downloads require no credentials, and Mill and sbt use Central by default. GitHub
Packages also hosts the libraries; its resolver requires a classic PAT with
read:packages.
See Getting started for both options.
GitHub Packages releases through v0.18.1 used io.worxbend. Update dependency
coordinates to com.worxbend when moving to 0.18.3; Scala imports use io.worxbend.tui.
Migrating to 0.21.0
0.21.0 repairs correctness, security, lifecycle and performance defects found in the 0.20.0 implementation. It is a minor release because several corrections change public source APIs. Recompile consumers and apply these migrations when upgrading:
- Framework keymap ids use
framework.. In user files,quit = ctrl+qnow names an app command; useframework.quit = ctrl+qfor the framework action. The same prefix applies tofocus-next,focus-previous,command-palette,close-modal,copy-selection,inspector,menu-bar,window-moveandwindow-resize.FrameworkKeysconstants supply the new ids. Explicit app binding ids must not use this reserved namespace. UseKeymap.validateandrebindEitherfor recoverable user-configuration errors;noneunbinds an entry. - Domain records replace public tuples. The DSL import exposes the new vocabulary:
GridItem.positionandGridSpot.positionuseOption[core.GridCell(row, col)], not coordinate pairs. The widget content record formerly namedwidgets.GridCellis nowGridEntry(placement, widget). The cell-enumeratingGridItem.cellsOfhelper is removed; grid occupancy is represented by rectangles rather than potentially unbounded cell sets.ExportPalette.rgbandpalette.Xterm256.rgbreturnRgb(r, g, b); custom palettes return that record and consumers read.r,.g,.b.Color.approximateRgbis unchanged.- Stateful
Lexer.highlightLine(line, theme, state)implementations returnLexedLine(line, next)instead of(Line, LexState); consumers read.lineand.next. Two-argument stateless lexer implementations remain unchanged. EditBuffer.selectionreturnsOption[TextRange], with ordered.startand.endgrapheme positions.PrettyShape.maptakesSeq[PrettyEntry[R]](key,value), andPrettyShape.producttakesSeq[PrettyField[R]](name,value).Accordion(Seq(title -> widget))becomesAccordion(Seq(Accordion.Section(title, widget))).MenuBar.titleSpanreturnsMenuBar.TitleSpan(x, width); toolbar helpers returnToolbar.Window(start, end)andSeq[Toolbar.Placement]. Read named fields, not_1/_2.
- JVM image decoding is explicit. Import
io.worxbend.tui.widgets.ImageIoLoaderforfromFile/fromBytes(formerly onImageLoader) andimageFromFile(formerlyImage.fromFile). JPEG/GIF/BMP remain supported through this adapter; it is intentionally not DSL-exported. Native-safe PNG loading isImageLoader.readPng(path).map(Image.fromRgba). - Named highlighting arguments use
lexer.SyntaxHighlighter.highlight(code, language = Language.Scala)becomesSyntaxHighlighter.highlight(code, lexer = Language.Scala); likewisehighlightLine(line, language = ...)becomeshighlightLine(line, lexer = ...). Positional calls are unchanged. - Composer ownership moves down a tier.
PromptComposerStateand reusable painting live intui-widgets, depending only on core. Existing DSL type/companion aliases andpromptComposercalls remain available; provider scheduling stays in the DSL adapter. Node-family relocation changes no factory spelling. Mutable JFR carriers are now runtime-private. - Embedding additions are compatible.
containeradds trailing defaultedmeasureWidth,TuiApp.focusKeyrequests focus without activation, andFrame/ImageProtocolare available through the DSL import.ListView.itemPrefixis a trailing optional parameter; existing positional constructor andcopystyle arguments remain compatible. - Custom runner/backend behavior is explicit.
RunnerHandlekeeps its optionalsetTaskbarStatefallback tosetTaskbarProgress(state.progress)(discarding error/paused styling and treating indeterminate as no fraction) and its no-opsetMouseCaptureMode. Override the latter to support dynamic hover/all-motion tracking. The three required0.20.0additions remainsetPointerShape,notifyDesktopandsetTaskbarProgress;suspend,printAboveandinsertBeforewere already abstract in0.19.0.Backend.redrawOwedis a new optional flag defaulting tofalse: diff-based backends expose pending full-redraw requests without consuming them,TerminalRunnerpolls it, anddrawconsumes the request. Custom runners should observe it too.
Hosted lazy-list misses now wait for the owed resolution frame, rather than constructing a second paint-only hook lifetime. Standalone widgets still build directly. Default password prompts and hidden text inputs paint a fixed blank row and report no caret, so neither frame symbols nor cell styles disclose password length. Explicit visible masks may disclose grapheme count, but never populate the clipboard or kill ring. See Editing and Prompts.
Migrating to 0.20.0
0.20.0 is a large minor release: a layout engine, component theming, key sequences, a shared editing core, mouse selection and drag and drop, the modern terminal protocols, print mode and two batches of widgets. Most of it is additive. The changes below are the ones that can stop a build or change what an existing app does; each says what changed, why, and what to write instead. The full list of additions is in the changelog.
Three changes reach almost every app, so check them first:
- a
panel's style builders now style its content, and the border is.frameStyle(…)(Theming); TuiApp.themedefaults toTheme.auto, which picksTheme.Lighton a light terminal (Terminal protocols);TuiAppcapturesSystem.out/System.errwhile it runs, soprintlngoes to the scrollback above the UI instead of over the frame (Runner configuration).
Layout
-
Constrainthas two new cases,AutoandBounded(min, max, base).Autosizes a segment to what its content measures (aFill(1)when the content cannot say);Boundedclamps a base constraint.Constraintis a sealed enum, so under-Werroran exhaustivematchwithout a wildcard stops compiling. Add the cases, or a wildcard so the next case does not break the match again — the enum's Scaladoc now says it grows:// beforeconstraint matchcase Constraint.Length(n) => ncase Constraint.Fill(_) | Constraint.Min(_) | Constraint.Max(_) |Constraint.Percentage(_) | Constraint.Ratio(_, _) => 0// afterconstraint matchcase Constraint.Length(n) => ncase _ => 0 -
.minSize/.maxSizecompose with a size instead of replacing it. Before, the last constraint builder called won, so.minSize(8).fillwas a plain fill. Now a size and a bound combine in either order intoConstraint.Bounded, because "fill, but at least 20 and at most 60" could not be written at all..minSize(n)and.maxSize(n)on their own are stillMin(n)/Max(n).// before: both meant a plain fillpane.minSize(8).fill// after: the first is a fill floored at 8; drop the bound for the old meaningpane.fill -
scrollViewscrolls to the focused child. When focus moves (Tab, Shift+Tab,focusTo) onto a child outside the viewport, the view scrolls just far enough to show it, on the same frame and once per focus move. Apps used to redo thescrollTo(row)arithmetic themselves. An app that drives the offset itself turns it off:scrollView(content, state).followFocus(false) -
Every enclosing
scrollViewfollows a reveal, and none paints twice. A focused child or an.ensureVisiblemark inside nested scroll views now scrolls each of them — before, only the innermost moved, and the outer one could leave the target off screen. The view resolves the scroll before painting, from where the previous frame painted the target, instead of painting its content a second time at the new offset;boundsOfand the other recorded rects are therefore never one frame stale. A child that was not on the previous frame (one that just appeared marked.ensureVisible) is scrolled to on the next frame rather than the same one, and aPilottest that waits for idle sees no difference. An outer view whose offset the app pins opts out as before:scrollView(column(header, scrollView(list, inner).length(5)), outer).followFocus(false) -
button(…)measures its own width (ButtonisMeasured). Aflownow lays buttons side by side instead of one per line, and.autosizes a button to its label. To keep a button on a line of its own, put it in its owncolumn(…)or give it.fill.// before: four lines; after: one wrapped rowflow()(button("New")(n()), button("Open")(o()), button("Save")(s()), button("Quit")(q())) -
dropdownfloats its list instead of reflowing its siblings. The node claims one row whether open or closed, and the list is drawn at the frame root likeportalcontent — below the row when there is room, above it when there is not, never clipped by the enclosing panel. Before, an open dropdown claimed1 + maxVisibleRows + 2rows and pushed everything below it down, and one near the bottom of a short area got a clipped list. A click outside an open list now closes it and is spent on that — the control under the pointer does not also get the click — and Tab closes the list on its way to the next control. Nothing to change unless a test pinned the reflowed positions. -
responsiveis an object.responsive(build)andresponsive { size => … }compile unchanged; the newresponsive.local { size => … }is the container-query form. Only code that passedresponsiveitself as a function value has to nameapply:// beforeval wrap: (Size => Element) => Element = responsive// afterval wrap: (Size => Element) => Element = responsive.apply -
Panel slots.
panel(…).header(e)/.footer(e)put an element in a border row, and the slots are ordinary children for focus, hit-testing and theming — soPanelElement.childrenis nowcontent ++ header ++ footer(a slot on a side with no border drawn is left out: it is neither painted nor a focus stop), and the node's constructor field for the stacked children is renamedchildren→content. The factories are unchanged; code that built a node by hand moves to the new name, or better, to the factory:// beforePanelElement(Some("t"), children = Seq(text("x")))// afterpanel("t")(text("x"))Not breaking, but the spelling changes: a
panel(…).borderlessthat existed only for its padding is now the padding itself —form.padding(1),.padding(Padding.symmetric(2, 1)), or.padding(1, 2)(rows, then columns) on any element. -
scrollbar(…).at(offset)is.thumbAt(offset)andnotice(…).at(time)is.stamped(time). Every element takes.at(row, col)as its place in agrid, but these two nodes declared a memberatof their own, and a member shadows an extension — so a scrollbar or a notice could not be placed in a grid by row and column at all. The two old methods are renamed; nothing else changes.// beforescrollbar(200).at(40)notice("saved", NoticeLevel.Success).at(LocalTime.now())// afterscrollbar(200).thumbAt(40)notice("saved", NoticeLevel.Success).stamped(LocalTime.now()) -
Smaller:
Layout.applygained acrossAlignparameter, with the 0.19.0 five-argument arity kept as a default-free overload;Layout.toStringadds, crossAlign=…only when it is notStretch.widgets.LayoutItemgainedalignandRow/ColumngainedcrossAlign, appended with defaults, so their extractors have one more field.widgets.ColumnisMeasured.text(clipped),lineandbadgenow claim their size throughMeasured(Constraint.Auto); the layout they get is identical.
Theming, style and frameStyle
-
Theme.disabledis a stored role. It still readsmuted.dimuntil a theme sets it withwithDisabled(style)or a theme file'sdisabled = …, so nothing changes for a theme that does not.Themeequality now also compares the set role, andTheme.renderwrites adisabledline only for a theme that set one. -
stylemeans the content style on every node; a panel's border is.frameStyle(…). On apanelthe style builders (.fg,.bg,.bold,.dim,.styled(…)) used to recolour the border;stylemeant the border onpanel, the text ontext, the body on a list and nothing onwidget(…). Now they style the content, layered under the children the waywithStyledoes, so a child's own colour still wins. The border has its own field, set with.frameStyle(style)(replace) or.frameStyle(transform)(edit the theme'sborder); without atitleStyle, captions follow the frame style. A call left as it was still compiles, and now colours the content — so search for style builders on panels:// before (0.19)panel("Danger zone")(body).doubleBorder.fg(Color.Red)panel(metric.label)(rows*).styled(_.patch(band.style))// after (0.20)panel("Danger zone")(body).doubleBorder.frameStyle(_.withFg(Color.Red))panel(metric.label)(rows*).frameStyle(_.patch(band.style))Code that read
panelElement.props.styleto get the border readspanelElement.frameStyle. New container nodes follow the same split —window(title, state)(content)included: its border is.frameStyle(…), the theme'sborderby default and bold while focus is inside it. -
withStyle(transform)(subtree)returns one scope node. It used to returnsubtreerebuilt with the style patched into every node's props, on every frame. It now returns aStyleScopeElementwrappingsubtreeunchanged, and the style reaches the descendants at paint. What is drawn is the same. Only code that inspected the result changes:withStyle(…)(row(a, b)).childrenisSeq(row(a, b)), and the children'sprops.styleno longer carry the inherited style. Test what is painted, throughElementHostorPilot. -
Elements built outside a view paint in the app's theme. A themed factory (
panel,rule,gauge,progressBar, the spinners and skeletons,notice,badge,dialog,markdown,logConsole, …) called where onlyTheme.defaultis in scope — a top-leveldef, a helper object — used to paint dark-theme colours even in aTheme.Lightapp. It is now re-resolved against the app's theme when painted, keeping any builders applied afterwards. A helper that wanted the dark palette passes it:panel("x")(body)(using Theme.Dark). The chrome buildersstatusBar,topBar,helpOverlayandwhichKeyPopupand the.border()decorator are late-bound too: a composite builder rebuilds its subtree under the app's theme and keeps what was applied to the node it returned. -
given Theme.defaultis its own instance,==toTheme.Darkbut noteq, so late binding can tell "no theme in scope" from an explicitusing Theme.Dark. Replacesummon[Theme] eq Theme.Darkwith==. -
Themecarries component styles.Theme.applytakescomponentsas a new last parameter (defaultMap.empty), and every preset now carriesbutton.primaryandbutton.dangercomponents. A theme rebuilt field by field from a preset loses those unless it passes them on; prefer thewith*builders:// beforeTheme(name = "mine", primary = p, /* … */ syntax = Theme.Dark.syntax)// afterTheme(name = "mine", primary = p, /* … */ syntax = Theme.Dark.syntax, components = Theme.Dark.components)// orTheme.Dark.withName("mine").withPrimary(p)With no
.variant(…)nothing renders differently: no preset styles the defaultbutton,input,listortable.headerroles.Theme.LightandTheme.HighContrastgain values of their own for the newMarkdownThemeandSyntaxThemefields. -
dialog(…)returns aDialogElement, not aWidgetElement. The picture dialog now has a component role (DialogRole,"dialog", andDialogRole.Selectedfor the selected button), so it is a node of its own. Code that only places it compiles unchanged; code that annotated the type, or called aWidgetElementmember such as.rows(n)on it, changes:// beforeval box: WidgetElement = dialog("Saved", "Written.")// afterval box: DialogElement = dialog("Saved", "Written.") // or just ElementConfirmDialogElementkeeps the theme'sprimaryin a new last fieldbodyStyleinstead of inprops.style, soconfirmDialog(…).props.styleis nowStyle.Defaultand an explicit.fg(…)on it layers over the theme's"dialog"component. What is drawn under a theme with no"dialog"component is unchanged. -
widget(…)leaves honour the element style..fg,.bg,.style(…)and awithStylecascade used to be ignored on a rawwidget(…)leaf. They are now painted under what the widget draws: every cell of the area takes the style's fields the cell left unset. A leaf that carried a style by accident — usually an inheritedwithStyle— now shows it; drop the style, or move the leaf out of thewithStylescope, to keep the old frame. -
Search highlights follow the theme. A searchable
log,scrollViewormarkdownused to highlight in fixed black on yellow (match) and black on bright red, bold (current match). They now take the theme's"search.match"/"search.current"components (SearchRole.Match,SearchRole.Current) and, without them, the theme'swarninganderrorcolours as a background under black text. UnderTheme.Darkthe match colour is unchanged and the current match moves from bright red to red; styled golden frames of a searched view need re-recording. To keep the old colours:Theme.Dark.withComponent(SearchRole.Match, StateStyles(base = Style.of(Color.Black, Color.Yellow))).withComponent(SearchRole.Current, StateStyles(base = Style.of(Color.Black, Color.BrightRed).bold)) -
Theme files carry
loading.fill-ramp.Theme.renderwrites one more line,loading.fill-ramp = noneor the ramp's comma-separated stops, andTheme.parsereads it, so a ramp no longer falls back to the base theme's. A file written before reads exactly as before.
Keys and bindings
-
KeyBinding.triggersisSeq[KeySequence], where a single key is a one-step sequence, so"g g"and"ctrl+k ctrl+s"share one dispatch path with single keys.KeyBindingalso gains two trailing defaulted fields,explicitIdandmode. Code that goes through thebinding(…)factories is unaffected; code that builds aKeyBindingor reads its triggers wraps or unwraps them:// beforeKeyBinding(Seq(KeyEvent.char('s')), "s", "save", () => save())binding.triggers.contains(event)// afterKeyBinding(Seq(KeySequence.of(KeyEvent.char('s'))), "s", "save", () => save())binding.triggers.exists(_.keys == Vector(event)) -
A prefix that is also a binding throws at construction.
KeyBindings(…)andKeyBindings.modes(…)throwIllegalArgumentException, naming both, when one sequence is a strict prefix of another in the same mode. Only sequences can do that — except a plain space-bar binding next to a<leader>binding under the default (space) leader. Choose another leader before the bindings:given KeyLeader = KeyLeader(","). -
Framework keys are rebindable ids. Tab, Shift+Tab, Ctrl+P, Ctrl+C and Esc are
FrameworkKeysfields with the idsfocus-next,focus-previous,command-palette,quitandclose-modal, read from the overridableTuiApp.frameworkKeys; the PageUp/PageDown step (a hard-coded 10) isFrameworkKeys.pageStep. Defaults and matching are unchanged, so nothing behaves differently unless the app overridesframeworkKeys:override def frameworkKeys: FrameworkKeys =FrameworkKeys.default.rebind(Keymap.parse(userFile).getOrElse(Map.empty)).copy(pageStep = 20) -
New framework keys that act where they used to do nothing. F12 (
inspector) toggles the inspector overlay; Ctrl+Shift+C (copy-selection) copies a mouse selection while one shows — before, it matchedquit(Ctrl+C plus any modifiers) and quit, which it still does with nothing selected; F10 (menu-bar), Alt+M (window-move) and Alt+R (window-resize) act only when the view contains amenuBaror awindow. Bindings and focused elements still see each key first. Move one with a user keymap:override def frameworkKeys: FrameworkKeys =FrameworkKeys.default.rebind(Map(FrameworkKeys.Inspector -> keyseq"ctrl+alt+i"))FrameworkKeysgained these six fields at the end, all defaulted, so positional construction andcopykeep compiling; a positional pattern overFrameworkKeys(…)needs more binders.FrameworkKeys.entries, and soKeymap.markdown(bindings, frameworkKeys), lists more rows. -
FrameworkKeysfields areKeySequences, notKeyEvents, so the keysTuiApphandles itself (focus-next,focus-previous,command-palette,quit,close-modal,inspector,copy-selection) can be sequences, andKeymapEntry.keyis aKeySequencetoo.FrameworkKeys.rebindno longer throws for a multi-keyquitorinspector; it still throws formenu-bar,window-moveandwindow-resize, which elements read one key at a time.fires(key, event)keeps its name and takes the sequence. Code going throughrebindandkeyseq"…"is unaffected; code that builds the value or compares a field to aKeyEventwraps it:// beforeFrameworkKeys.default.copy(quit = KeyEvent(KeyCode.Char('q'), KeyModifiers.Ctrl))keys.inspector == KeyEvent.of(KeyCode.F(11))// afterFrameworkKeys.default.copy(quit = keyseq"ctrl+q")keys.inspector == keyseq"f11"FrameworkKeys.unbind(ids*)andTuiApp.inspector = falseturn a key — the F12 inspector, typically — off. -
Keymap files read
#after a space as a comment.save = ctrl+s # noteused to fail to parse; it now bindsctrl+s. A keymap that bound the#key asmark = #must spell itmark = \#(inside a step,ctrl+#is unchanged). -
Keys taken ahead of the focused control. A
menuBartakesAlt+<mnemonic>(and the arrows, Enter and Esc while a menu is open) before the focused control sees it, and awindowtakes Alt+M/Alt+R while focus is inside it. The one exception is a focused text field's own Alt+B/Alt+D/Alt+F/Alt+Y chords, which stay with the field while no menu is open; F10 then the mnemonic letter reaches that menu from inside the field (see Alt keys: menu bar or text field). Apps without these nodes are unaffected. -
Focused text fields consume the editing chords — see Editing; an app binding on Ctrl+U, Ctrl+W, Ctrl+Z, Ctrl+Y, Ctrl+K or Ctrl+A no longer fires while an
inputortextAreahas focus. -
Prompt.formsteps back with Shift+Tab, not Ctrl-U. Ctrl-U was the form's "previous field" key, which took kill-to-line-start away from every text field in a form. The back key is now thefocus-previousframework key (Shift+Tab by default), and Ctrl-U kills to the start of the line as it does in anyinput. Nothing to change in code; tell users, or move the key:# before: Ctrl-U -> previous field# after: Shift+Tab -> previous field, Ctrl-U -> kill to line start -
statusBar(bindings)leads with[mode]when the bindings declare modes and shows a pending prefix with its continuations; the command palette lists only the live mode's bindings. Apps without sequences or modes render exactly as before.
Editing
-
Undo is coalesced and diff-based.
TextAreaState— and nowTextInputState— store diffs instead of a whole-document snapshot per edit, and consecutive single-grapheme inserts join one undo step, as do consecutive backspaces and forward deletes. A space after a word, any caret move, a selection change, undo or redo starts a new step; the history keeps the newest 100 steps. Snapshotting cost O(document) memory per keystroke and made Ctrl+Z undo one character at a time.// before: three undo stepsstate.insert("a"); state.insert("b"); state.insert("c")state.undo() // "ab"// after: one step — call breakUndoGroup() between edits to keep them apartstate.undo() // ""TextInputStategainsundo()/redo();clear()on either state also forgets the history. -
In a focused
textArea, Ctrl+Y yanks and redo is Ctrl+Shift+Z. Ctrl+Y used to redo; it now yanks the newest kill-ring entry, as ininputand readline, because the kill ring needs it. -
Focused
inputandtextAreaconsume more chords: Ctrl+A, Ctrl+V, Ctrl+K, Ctrl+U, Ctrl+W, Ctrl+Y, Ctrl+Z, Ctrl+arrows, Alt+B/F/D/Y, Alt+Backspace, Shift+motion, and Ctrl+C / Ctrl+X while text is selected;textAreaalso takes Ctrl+F and F3. Move an app binding on one of these to another chord, or bind it on an ancestor'sonKeyEvent. Ctrl+C with nothing selected still bubbles, so it still quits. -
TextInputStateandTextAreaStateextend the newEditBuffer. Every public method keeps its name and meaning. The motion methods gained a defaultedselect: Boolean = false, sostate.moveLeft()compiles but passingstate.moveLeftas a() => Unitvalue needs() => state.moveLeft(). Both constructors take an optionalKillRing. -
TextAreaOptionsgrew fields, andsyntaxis now the fourth, so a positionalTextAreaOptions(Some(lexer), theme)must name it:TextAreaOptions(lexer = Some(lexer), syntax = theme).TextAreaElementgainedoptionsandeditablefields; usetextArea(state, options)and.readOnly. -
The terminal's own cursor follows the focused text field.
input,numberInput,templateInput,autocomplete,textAreaand the command palette's filter report their caret, and the frame parks the hardware cursor there; it hides when focus leaves text. Before, the DSL painted a reverse-video cell and left the terminal cursor hidden — invisible to screen readers and to input-method popups. The default isCaretStyle.Both; keep the old look with.caretStyle(CaretStyle.Painted):// before: painted cell only, implicitlyinput(name)// after: both by default; pick one explicitlyinput(name).caretStyle(CaretStyle.Painted)A
Pilottest that assertedassertNoCursor()while a text field had focus now fails; assertassertCursorAt(x, y)instead, or setCaretStyle.Paintedon the field under test. -
TextAreaStatesearch normalises to NFC, so a precomposedéin the query matcheseplus a combining acute in the text, which used to find nothing. Smartcase is unchanged. -
Up and Down under
.wrapmove by wrapped row. In a soft-wrappedtextArea, Down from the first row of a long line now goes to that line's second row at the same display column; before, it jumped to the next logical line, skipping every wrapped row in between. Without wrap nothing changes. A test that pinned the old jump moves its expectation, or renders without wrap:// "aaaa bbbb cccc\nxy" in a 10-column textArea, caret at (0, 2)state.moveDown()// before: (1, 2) on the next line; after: (0, 12) on the wrapped row below
State and hooks
-
eachscopes its rows' hooks under the item key.each(items)(key)(render)runsrenderinsidekeyed(key)as well as stamping.key(key), so focus anduseSignal/useStateshare one identity and follow the item through reorders. Hook state declared directly inside aneachrow (with nokeyedof its own) therefore moves from a positional slot to the key's and starts fresh once on upgrade. A row that was already wrapped inkeyed(sameKey)keeps its state: akeyedopened as the first thing inside a scope of the same key is that scope, not a second one under it, so the path stayssameKey. The innerkeyedcan go:// beforecolumn(items.get.map(item => keyed(item.id)(row(item)).key(item.id))*)// aftercolumn(each(items.get)(_.id)(row)*) -
Widget states schedule their own frames. Every caller-owned widget state (
ListState,TreeState,ScrollViewState,DataTableState,LogState,TextInputState,TextAreaState, the new picker states,MarkdownStream, …) isVersioned: each mutation raisesversion, and aTuiAppredraws when a painted state's version moves. A render-thread write outside an event handler — anAsynccontinuation — is drawn without aSignalwrite orrequestRedraw(); an app may see a frame where it used to see none. A redraw request that only followed a widget-state write can go:// beforeAsync.run(fetchLines()) { lines => lines.foreach(log.append); requestRedraw() }// afterAsync.run(fetchLines())(lines => lines.foreach(log.append))An
ElementHostthat owns its loop callshost.pollStates()once per iteration for the same. A new caller-owned state class must extendVersionedand bump its version on every mutation. -
ListState,MenuStateandDropdownStateare built throughapply. Their constructorvars became getter/setter pairs that count writes, so the primary constructors are private.ListState(selected = Some(0)),state.selected = …andstate.offset += 1compile unchanged; onlynewbreaks:// beforeval list = new ListState(selected = Some(0))// afterval list = ListState(selected = Some(0)) -
TreeStatetakes a type parameter, so a state can be keyed by node identity (TreeState.keyed(_.label),TreeState.byLabelPath) and keep expansion and selection across a reordering refresh.TreeState()still infers the positionalTreeState[Seq[Int]]; only an explicit annotation changes:// beforedef helper(state: TreeState): Unit// afterdef helper(state: TreeState[Seq[Int]]): Unit // or TreeState[?] to only render or navigateTreeState.togglenow ignores a selection that names no visible row; it used to toggle a hidden node inside a collapsed branch. -
ListViewremembers its item layout on theListState, once peritemsreference, so a frame no longer walks every item. ASeqmutated in place under the same reference is re-measured when its count changes or a drawn item's height disagrees; an off-screen item that changed height is noticed when it scrolls in. Replace the sequence, as aSignal[Vector[…]]does, rather than mutating it. -
DataTablechecks the previous row first for the selected key. With duplicate keys — whichKeyedRowalready forbids — a selection on the second duplicate now stays there. -
The hook-outside-a-view error now names every hook (
useSignal,useState,useEffect,useMemo,useTask,useArea); a test matching the old message prefix needs updating.
Mouse and selection
-
MouseEventhas a fifth field,clickCount: Int = 1. Terminals never report a double click, so the DSL host synthesises one: aDownwith the same button on the same cell within 400 ms carriesclickCount = 2, then 3. Construction is unaffected; a four-field positional pattern stops compiling:// beforecase MouseEvent(Position(x, y), MouseEventKind.Down, _, MouseButton.Left) => …// aftercase MouseEvent(Position(x, y), MouseEventKind.Down, _, MouseButton.Left, _) => … -
A consumed mouse-down captures the pointer. Every
Dragand theUpuntil release go to the pressed element, with its press-time area, even after the pointer has left it — so a slider or split divider keeps following a drag past its edge and anonDragEndfires for a release outside. Handlers that assumed aDraglies inside their area should clamp. A press nobody consumed captures nothing. Across recomposition, a unique key retains capture and the press-time area through reorder; changing the key starts a new lifetime. A rebuilt unkeyed built-in retains its original handlers only with the same caller-owned signal or widget-state references and unchanged input topology. A same-slot state replacement, unknown ownership, rebuilt user handler, removal, clipping out, disabling or focus-layer transition cancels capture; its tail is discarded until a fresh press. Ordinary unkeyed sliders therefore remain draggable through pressed-cue redraws without keeping a retired signal alive after replacement. -
Prefer
.onMouse(ctx => …)to absolute coordinates. It hands the handlerctx.local, relative to the element's top-left, andctx.area..onMouseEvent,onClickAt,onHoverandonDragstay and run first.// beforecanvas(w, h)(draw).onMouseEvent { e => plot(Position(e.position.x - knownX, e.position.y - knownY)); true }// aftercanvas(w, h)(draw).onMouse { ctx => plot(ctx.local); true } -
A mouse-capturing
TuiAppmay switch to all-motion tracking by itself: the first frame that draws a.hoverStyle(…), a.pressedStyle(…)(or a theme component with a hovered or pressed style) or an explicit.pointer(shape)asks the terminal for every pointer movement (more input traffic over ssh). Apps with mouse capture off never switch; to stay on button-only tracking, use none of them. Hovered and pressed marks follow a keyed control when the tree reshapes before the next frame, rather than staying on its old position.ElementHost.dispatchMousemay now answertruefor an unconsumed event when a hover or pressed cue needs a repaint. -
A dropdown's floating list can let the closing click through:
.passThroughOutsidecloses the list and delivers the click to the control under the pointer; without it the click is still spent on closing. -
Keys a selection or a drag now takes. In a mouse-capturing app, Shift+arrows that the focused node does not use select text when that node is selectable (
text(…).focusable,log,dataTable), so they no longer reach an app binding on Shift+arrows while such a node has focus;Escwhile a drag and drop is in flight cancels the drag and is spent on that. Bind the app's own Shift+arrow command on another key, or mark the node.selectable(false). -
Mouse-capturing apps select text. With
RunnerConfig(mouse = MouseCaptureMode.Buttons), a left drag overtext,markdown,log,logConsoleor a table selects text and copies it through OSC 52 on release, because capturing the mouse took the terminal's own selection away. A press an element consumes (a button, a list row) never starts one. Opt a subtree out:// before: a drag over the log did nothinglogConsole(ring)// after, to keep thatlogConsole(ring).selectable(false) -
Press and motion on a
.draggableelement is a drag. ItsDrag/Upevents go to the drag gesture, not the element'sonDrag/onDragEnd; a press and release without motion is still a click. -
A click on a click-outside dialog's own border stays inside it. A modal pushed with
Dismissal.ClickOutsideorEscapeOrClickOutside, and anydismissibleOverlay, used to treat a press on the dialog's border, title or caption as outside. Now a press on any node of the dialog that draws something is absorbed, and only a press on layout-only nodes dismisses. A dialog that relied on a border press closing it has no replacement.dismissibleOverlay(content)(onOutsidePress)now returns its own node, whose single child iscontent, instead oflayers(backdrop, content); a test that destructured it as aLayersElementreadschildreninstead:// afterassert(overlay.children == Seq(dialog)) -
Bounds recording is on for every headless run, and on a real terminal from the first
boundsOf(key)call or click-outside modal; it does not change what a frame shows. On a real terminal (and throughElementHost.enableBoundsRecording()) it is narrow: keyed nodes, containers, input targets, pointer roles and everything under a click-outside backdrop, not unkeyed leaves. An embedding host that readsElementTreeSnapshot.render(host)callsenableFullBoundsRecording()to get every node's bounds back; the inspector does so itself. Nodes with a pointer role (selectable text, draggable, drop target) are recorded on every frame. -
A mouse selection stays on its node. It used to be held by the node's position in a pre-order count and by screen cells, so a node added anywhere above it moved the selection onto another node, and scrolling a
scrollViewslid the content out from under a highlight that stayed put. It is now held by the node's.key(…)(or, without one, its path of child positions) and by cells of the node's own area, so it survives the tree changing around it and scrolls with the content. Nothing to change in code; a test that expected the highlight to stay on a screen row after a scroll moves its expectation with the content.
Terminal protocols and Theme.auto
-
TuiApp.themedefaults toTheme.auto, notTheme.Dark.Theme.autoresolves on every frame toTheme.Lighton a terminal that reported a light background (OSC 11 at start-up, or a mode 2031 report since) and toTheme.Darkotherwise — including every terminal that cannot say, which is what every app got before. An app that overridesthemesees no change; to keep the dark palette on light terminals, say so:// before: nothing — Dark was the default// afteroverride def theme: Theme = Theme.DarkHeadless tests are unaffected:
HeadlessBackendreports no colour unless a test installs one withbackend.capabilitiesTo(TerminalCapabilities(backgroundColor = Some(Color.Rgb(255, 255, 255)))). -
EventgainedColorSchemeChanged(scheme). An exhaustivematchoverEventwithout a wildcard needs a new arm;TuiAppusers never matchEvent. -
TerminalCapabilitiesgained eleven defaulted fields afterfocusReporting—backgroundColor,reportedColorScheme,colorSchemeUpdates,inBandResize,unicodeWidth,pointerShapes,desktopNotifications,taskbarProgress,terminalVersion(the XTVERSION reply),kittyGraphicsandinlineImages— plusdef colorScheme. Named construction andcopyare unaffected; a positional patternTerminalCapabilities(a, b, c, d)no longer compiles — read the fields by name. -
The start-up probe asks more. It adds DECRQM for modes 2031, 2048 and 2027, OSC 11, DSR 996, XTVERSION (
CSI > 0 q) and the kitty graphics query (an APC string) before the DA1 fence. The backend enables modes 2031 and 2027 unless the terminal denied them, and 2048 only on an explicit yes, and resets all three — and the pointer shape — on the way out. A test that models the wire byte for byte gains those sequences and must accept APC strings.GLYPHORA_NO_CAPABILITY_PROBE=1still skips the whole round trip. -
ColorDepth.detecthonoursFORCE_COLOR(0off;1,2,3force 16, 256 or true colour; anything else forces colour on, likeCLICOLOR_FORCE) and, above everything else when set,GLYPHORA_COLOR_DEPTH. A CI runner that setsFORCE_COLORfor Node tooling now gets the forced depth; unset it or overrideTuiApp.colorDepth. The other new overrides —GLYPHORA_KEYBOARD=legacy,GLYPHORA_MOUSE=off|buttons,GLYPHORA_ESCAPE_DELAY,GLYPHORA_DEBUG_LAYOUT=1— change nothing unless set. -
HeadlessBackend.drawruns the picture bookkeeping the JLine backend runs. For a frame that places pictures (Buffer.placeGraphic), placements the installed capabilities cannot draw are dropped, and the protocol bytes owed are appended torawSequencesas one entry. Frames with no pictures behave as before. -
BackendgainedsetPointerShape,notifyDesktop,setTaskbarProgressandkeepInlineRows, all with no-op defaults, so a custom backend keeps compiling.JLine3Backend.wrappingtakes an optionalenv.
Runner configuration and stdio capture
-
TuiAppcapturesSystem.out,System.errand Scala'sprintlnby default. While an app runs, each completed line is written into the scrollback above the live UI; a partial line left at exit is flushed once the terminal is restored, andsuspendpasses the streams straight through. Before, aprintlnfrom a handler painted over the frame. An app that relied onprintlnreaching a redirected stdout while running — a wrapper reading its pipe live — opts out:// before: nothing to write; println went to System.out, and onto the frame// afteroverride def config: RunnerConfig = RunnerConfig.Default.withCaptureStdio(CaptureStdio.Off)Only a configuration whose
captureStdiois unset takes the app default, so an existingoverride def config = RunnerConfig(tickRate = Some(d))keeps the capture. A bareTerminalRunnerreads the unset field asOffand behaves as before. -
RunnerConfig's mouse setting is oneMouseCaptureMode, not a Boolean. 0.19.0'smouseCapture: Booleancould say "off" or "buttons", and a second Boolean for hover would have allowed motion tracking with capture off. The field is nowmouse: MouseCaptureMode—Off(the default),ButtonsorAllMotion— andMouseCaptureModegained theOffcase (Backend.enableMouseCapture(MouseCaptureMode.Off)isdisableMouseCapture(), so an exhaustive match on the enum needs that case).withMouseCapture(buttons) andwithoutMouseCapture(off) keep working,withMouse(mode)sets any mode, andconfig.mouseCapturestays as a derivedBoolean. The positional Boolean arities ofapplystill compile,truemeaningButtons; the named argumentmouseCapture = truedoes not, since the defaultedapplycan only take one type for it:// beforeRunnerConfig(tickRate = Some(rate), mouseCapture = true)// afterRunnerConfig(tickRate = Some(rate), mouse = MouseCaptureMode.Buttons)// or, unaffected by the next field: RunnerConfig.Default.withTickRate(rate).withMouseCapture -
RunnerConfiggained three fields:captureStdio(withCaptureStdio/withoutCaptureStdio),recording(withRecording/withoutRecording) andnonInteractive(withNonInteractive, defaultNonInteractivePolicy.Fail, the old behaviour). As the growth policy promised, every earlier arity of the companionapply— seven, eight, nine and ten fields, each with its BooleanmouseCapture— is kept as a default-free overload, so compiled callers keep linking;with*chains compile unchanged. A positional call to one of the intermediate pre-release arities is clearest rewritten as a builder chain:// before (positional)RunnerConfig(rate, true, None, None, Viewport.Fullscreen, false, None, Some(CaptureStdio.Off))// afterRunnerConfig.Default.withTickRate(rate).withMouseCapture.withCaptureStdio(CaptureStdio.Off) -
-Dglyphora.record=<file>makes everyTerminalRunnerrun whose configuration names no recording write an asciicast v2 file; without the property nothing changes. A recording path that cannot be opened endsrunwithRunnerError.Handler(IOException)before the terminal is touched. -
Hand-written
AppServices,NotificationsandRunnerHandleimplementations (usually test doubles) must add the new abstract members; apps that only call them, andAppServices.NoOp, are unaffected.AppServicesgainedcolorScheme,taskbarProgress(source),clearTaskbarProgress(),keyMode(returnSignal(ModeId.Default)),editExternallyandopenInEditor, andrunEffect(key, effect)— kept abstract on purpose, because a default that ignored the key would silently keep the stacking bug it fixes;runEffect(key, effect, scope)andclipboardare concrete with defaults.Notificationsgaineddesktop(title, body).RunnerHandlegained the abstractsetPointerShape,notifyDesktopandsetTaskbarProgress(output-only test doubles can implement these three as()).suspend(body),printAbove(lines)andinsertBefore(height, widget)were already abstract in 0.19. The two optional additions preserve source compatibility:setTaskbarStatedefaults to fractional progress, andsetMouseCaptureModedefaults to a no-op. A custom handle must overridesetMouseCaptureModeto support dynamic hover/all-motion tracking; the production terminal handle implements both methods fully.// after: AppServices-specific additions (also implement Notifications.desktop as noted above)def runEffect(key: String, effect: Effect): Unit = ()def editExternally(initial: String, suffix: String): Option[String] = Nonedef openInEditor(path: Path, line: Option[Int]): Unit = ()def keyMode: Signal[ModeId] = Signal(ModeId.Default)def colorScheme: Reactive[ColorScheme] = Signal(ColorScheme.Unknown)def taskbarProgress(progress: Reactive[Option[Double]]): Unit = ()def taskbarState(state: Reactive[TaskbarState]): Unit = ()def clearTaskbarProgress(): Unit = () -
object TuiAppnow exists as a companion; nothing changes unless code relied on its absence.
Print mode
-
Consoleunder the one import is glyphora's print-mode object.Console.print(view)renders any element once to standard output, the name every terminal toolkit uses. Underimport io.worxbend.tui.dsl.*it shadowsscala.Console, so a file with that import that writesConsole.errorConsole.printlnspells the standard one out:// beforeConsole.err.println("failed")// afterscala.Console.err.println("failed") // or System.err.println -
No-TTY runs are unchanged unless asked for. Under the default
NonInteractivePolicy.Fail, an app started without a TTY still printsglyphora: terminal not supported: …and exits 1. To render instead:override def config: RunnerConfig =RunnerConfig.Default.withNonInteractive(NonInteractivePolicy.PrintFinalFrame)See Print mode.
Selection ranges
EditBuffer.selection (also inherited by TextInputState and TextAreaState)
now returns Option[TextRange] instead of Option[(TextPosition, TextPosition)].
Read range.start and range.end rather than _1 and _2; both are grapheme
positions in document order, whichever direction the selection was extended.
TextRange is available through the DSL import as well as tui-widgets.
Pretty description builders
Custom PrettyShape[R] implementations now receive named records rather than
positional tuples: map(name, entries: Seq[PrettyEntry[R]]) reads entry.key and
entry.value; product(name, fields: Seq[PrettyField[R]]) reads field.name and
field.value. PrettyEntry and PrettyField are immutable values in tui-macros
and are also available through the DSL import. Derived Pretty instances and
inspect(value) callers need no changes.
Widgets
-
An unfocused
confirmDialogunderlines its selected button instead of painting it in the focus cue. In 0.19 the selected button wore the theme'sfocusstyle whether or not the dialog held focus, so moving focus onto it changed nothing on screen —pilot.a11yReport'sNoFocusCue. The focus cue now shows only while the dialog is focused, and a resting dialog marks its selection with an underline. The 0.20 pickers (datePicker,timePicker,colorPicker) follow the same rule. Nothing to change in code; a golden frame that records styles of an unfocused dialog needs re-recording. -
Languageis an alias for the openLexertrait.widgets.Languagewas a closed enum; it is nowtype Language = Lexerwith anobject LanguagewhoseScala,Json,BashandGenericare lexer values, so anyone can add a language.SyntaxHighlighter.highlight(code, Language.Scala),Language.of("sh"), equality andcase Language.Scala =>still compile;Language.values,valueOf,.ordinaland exhaustivity do not, andLanguage.of("yaml")now answers the YAML lexer rather thanGeneric. ThehighlightandhighlightLinenamed argument changed fromlanguage = Language.Scalatolexer = Language.Scala; positional calls are unchanged:// before (0.19)def label(l: Language): String = l matchcase Language.Scala => "Scala"case Language.Json => "JSON"case Language.Bash => "Shell"case Language.Generic => "Text"// after (0.20)def label(l: Lexer): String = l.name -
markdownrenders more of the source. GFM tables, nested lists (indented, with per-level bullets), task lists (☐/☑) and+bullets render instead of showing literally; a fence's info string resolves only its first word, and the new lexers highlightyaml,sql,diffand other fences that used to render verbatim. To keep a list flat remove its indentation; to keep fences verbatim passMarkdownOptions(lexers = Seq.empty). -
Effect.slideInFromRightdelegates toslideIn(MotionDirection.Left, …), with the same frames; new code writesEffect.slideIn(MotionDirection.Left, duration). -
Search fields on scrolling nodes.
ScrollViewElement,LogElementandWidgetElementgained a trailingsearchfield, andLog/ScrollViewgained trailingmatchStyle/currentMatchStyleparameters with defaults; factory calls and the previous positional arity are unchanged. -
Node fields that grew.
DropdownElementgained a framework-onlyfloatingfield,ResponsiveElementgainedlocalandprobe, andElementPropsgainedcaretStyle,pointerShape,variant,lateBinding,selectable,dragPayloadanddropTargetat the end, all defaulted. Node constructors are not a compatibility surface (see below); code that spelled everyElementPropsfield positionally needs the extra arguments. -
Pictures in pixels are opt-in.
image(…)still draws half blocks.pixelImage(rgbaImage)draws real pixels through the kitty graphics protocol or iTerm2 inline images where the terminal can, and the same half blocks where it cannot:// afterpixelImage(RgbaImage.fromColors(pixels).toOption.get) -
dataTableanswers the mouse. A left press on a body row now selects that row (it used to only focus the table), and because the press is consumed, a drag on the table starts a text selection only once it covers two cells rather than from the first cell. An app that selected rows itself in.onMouseEventcan drop that code, or returntruefrom it to keep its own behaviour; a one-cell drag that used to copy one character now copies nothing. -
Picker and toolbar constructors grew.
ColorPickergainedmodeas its second parameter (aftershowCaption) andhighlightStyle/invalidStyleat the end, so a positionalColorPicker(false, style)must name its style:ColorPicker(showCaption = false, style = style).DatePickerStategainedminandmaxaftertoday,DatePickera trailingdisabledStyle,Inspecta trailinghighlightStyle(and it is now also aStatefulWidget[InspectState]). Among the nodes,ColorPickerElementgainedmodeandInspectElementgainedstatebeforeprops, andToolbarElement's first field is nowcontrols(itschildreninclude the overflow popup while it is open), followed byoverflow; factory calls are unchanged.// beforeColorPicker(false, captionStyle)// afterColorPicker(showCaption = false, style = captionStyle) -
A grid move resets a
ColorPickerState's RGB fields. Every arrow move,moveToand click on a swatch refills the R/G/B fields from that swatch and hands the keyboard back to the grid. Palette-mode pickers see no difference. -
MarkdownThemegainedtableHeader,tableBorderandtaskDone,SyntaxThemegainedinsertedanddeleted,Markdowngained anoptionsparameter andTextAreaanoptionsparameter — all appended with defaults. -
Two widget constructors gained a parameter, and one export option.
widgets.ScrollViewtakescontentIdentity: Option[Any] = NoneaftershowScrollbar, andwidgets.Searchabletakes it aftercontent: an equality-comparable stand-in for what the content draws, which a searched view compares to reuse the matches it found on the last frame. Named arguments and the DSL compile unchanged; a positional call that passed a style in those positions stops compiling and should name it.ExportOptionsgained a last field,ansiColors, so an extractor pattern on it needs one more_.BufferExport.ansiwrites the same bytes as before with the default; passExportOptions(ansiColors = depth.ansiColors)to export at a terminal's colour depth.// beforeScrollView(content, rows, true, matchStyle)// afterScrollView(content, rows, showScrollbar = true, matchStyle = matchStyle)
Text, search, diffs and tables
-
AnsiParserandText.fromAnsimove within the line as a terminal does. A tab used to be dropped; it now advances to the next eight-column stop. A bare\rused to be dropped, so a progress bar redrawn with\rread as every state glued together; it now returns to the first column and the text after it overwrites the line ("100%\r5%"reads5%0%, and erase-in-line,ESC [ K, is applied). CRLF output still splits into clean rows. To keep the old reading, strip the controls before parsing:// before (0.20 pre-release): tabs and \r vanishedText.fromAnsi(output)// after, for the same resultText.fromAnsi(output.replace("\t", "").replace("\r", "")) -
loghonoursLine.alignment. A centred or right-alignedLineappended to aLogStateused to be drawn at the left edge; it is now drawn where it asks to be, and a search highlight lands on it there. Appendline.leftAligned(or a line with no alignment) to keep it left. -
diffViewhighlights by file extension and takes more keys. With no.lexer(…), a file whose path ends.scala,.ts,.py,.yaml,.sql,.json,.md,.sh, … is now highlighted by that built-in lexer;DiffViewOptions(lexerFromPath = false)restores plain lines. A focuseddiffViewnow consumes Enter (expand the folded run on screen), a click (expand the run under it) and Left/Right (scroll the text sideways), which used to bubble.DiffViewOptionsgainedlexerFromPathright afterlexerandapproximateNoticeat the end, so a positional construction pastlexermust name its arguments.Patchgained a trailingapproximatefield (a patterncase Patch(files) =>needscase Patch(files, _)), andPatch.ofstops searching for a shortest diff pastmaxEditDistance(2 000 by default): past it the middle of the texts is one replacement and the patch isapproximate. Pass a largermaxEditDistancefor an exact diff of a larger change, at the memory cost the Scaladoc gives.// beforeDiffViewOptions(DiffLayout.Split, true, Some(3), true, Some(Lexer.Scala), myStyle)// afterDiffViewOptions(DiffLayout.Split, true, Some(3), true, Some(Lexer.Scala), style = myStyle) -
Lexers carry state between lines.
Lexergained a three-argumenthighlightLine(line, theme, state)with a default, so a lexer of your own compiles unchanged. The built-in ones now follow a block comment, a triple-quoted string or a template literal across lines inhighlight, a Markdown fence and atextArea, and the YAML lexer reads every line of a block scalar (key: |) as one string — a#in it is no longer a comment. Goldens of such code need re-recording. -
Constructors that grew.
DataTableOptionsgainedmultiLineafteralignments(name the later fields in a positional call);TreeNodegainedid: Option[String] = None(a patterncase TreeNode(label, children) =>needs a third_);TextAreaElementgained a trailingsearchandPromptComposerElementa trailingpromptGlyph. Factory calls are unchanged. -
promptComposergrows with wrapped rows. It used to be as tall as its logical lines, so a long line scrolled inside one row; it now measures its draft soft-wrapped at its width, up tomaxRows. A layout that relied on the one-row composer gets a taller one while a long line is typed; passPromptComposerState(maxRows = 1)to keep it one row. -
Wrapped Markdown list items hang under their text, and
hexViewerpads the ASCII column of a short last row. Both change frames only; goldens of them need re-recording. -
Effect.patternedcaches step evaluations, which assumes what theEffectcontract already says — an effect is a pure function of theelapsedit is handed. An inner effect that reads mutable state of its own may show a cached frame while the content underneath is unchanged; and a runningpatternedvalue is render-thread-only, so build one per place it plays.
New names under the one import
import io.worxbend.tui.dsl.* reaches many new names. An application that defines a top-level
member with one of them in a package where it also wildcard-imports the DSL now has an ambiguity;
rename its own, qualify one, or exclude the DSL's (import io.worxbend.tui.dsl.{markup as _, *}).
The likeliest clashes are Console (see Print mode), Pattern (with a wildcard
java.util.regex.* import — import the regex class by name instead, which takes precedence),
Patch, Hunk, DiffLine, Prompt, ProgressTask, Store, Codec, Persisted, memo,
markup, AnsiParser, inspect, placeholder, ColorTarget and LexState.
Built-in labels come from Messages
Every word the framework draws on its own — a bare dialog's OK, Screen.confirm's
buttons, the command palette, helpOverlay, the wizard, the inspector, searchBar and the
prompts — is read from the Messages table the run binds, with Messages.Default holding
the English strings earlier releases drew, so nothing changes until an app overrides it
(see the app shell). Two things can still bite:
-
TuiAppgained a concretedef messages: Messages. An app that already declares a member calledmessages— a chat app'sval messages = Signal(Vector.empty[String])— no longer compiles ("needsoverridemodifier"); rename it.// beforeval messages = Signal(Vector.empty[String])// afterval chatLog = Signal(Vector.empty[String]) -
Messagesis a new name under the one import; a type of your own calledMessagesin a package that wildcard-imports the DSL is now ambiguous — qualify one or exclude the DSL's (import io.worxbend.tui.dsl.{Messages as _, *}). -
The table also covers the which-key
…, the framework-key descriptions (FrameworkKeys.entries, soKeymap.markdown, now read the active table), the prompts' validation errors, and the severity icons and tags of notices, toasts andbadge(level). The English defaults are the strings earlier releases drew, so nothing changes until an app sets them.Messagesgained these as new trailing fields: positionalMessages(…)construction pastsearchPlaceholderand pattern matches onMessagesbreak; use thewith…builders. The widget-levelBadge.ofgained a trailinglabel: Option[String] = None.
Dialog sizes its box to its buttons
The Dialog widget (and so dialog, confirmDialog and Screen.confirm) used to size its
box from the message alone and silently drop buttons that did not fit, which a translated
label made the common case. The box now widens to the button row. A dialog whose buttons were
wider than its message draws a wider box than before; golden frames of such a dialog need
re-recording, and no source change is needed.
Runtime and terminal follow-ups
-
Codec's text form starts with a version tag.encodenow writes@1;(or the version a codec was built with) before the value, anddecodereads it. Text with no tag — every file a 0.20 pre-release wrote — still decodes, as version 1, so nothing on disk is lost; a file written now cannot be read by a build from before the tag. A persisted type that changes shape declares how to read its old one instead of falling back toinitial:// before: a changed Prefs decoded its old file as Left, and the signal started from initial// aftergiven Codec[Prefs] =Codec.derived[Prefs].versioned(2) { case 1 => Codec.readAs[PrefsV1](old => Prefs(old.theme, Nil)) } -
NonInteractivePolicygained the caseAwaitingIdle(printing, timeout), built withPrintFinalFrame.awaitIdle(5.seconds). An exhaustivematchover the enum needs an arm for it, or matchespolicy.output, which unwraps it. Policies built withoutawaitIdlebehave as before. -
Theme.auto.withX(...)stays automatic. In earlier 0.20 builds a builder onTheme.autoproduced a plain dark theme; it now resolves toTheme.Light.withX(...)on a light terminal andTheme.Dark.withX(...)otherwise (isAuto,resolve(scheme)). An app that relied on the old result to pin a dark palette writesTheme.Dark.withX(...).Theme.autois no longer equal toTheme.Dark.withName("auto"). -
ProgressTask.rateand the ETA follow a ten-second sliding window instead of the average since the start, so they react to a speed change and go unknown (-,--:--) after a stall longer than the window.ProgressTask(label, total, rateWindow = None)restores the average;rateWindow = Some(d)picks another window. -
One resize is one
Event.Resize. On a terminal with in-band resize reports (mode 2048) theSIGWINCHand the report for the same resize used to arrive as two events; a resize to the size just delivered is now dropped, whichever source it came from (the repaint afterSIGCONTis still delivered). The report's pixel fields now fillwindowSize's pixel cache, so noCSI 14 tround trip follows it. -
keepInlineRowserases the rows below the kept ones when the run closes, instead of relying on the last frame having left them blank. -
Captured lines under
CaptureStdio.PrintAboveare batched: everything printed between two frames reachesprintAbovein one call (one scrollback trip), and stdout and stderr share one ordered batch. Lines still queued when the loop closes go to the original stream instead of being dropped. A backend double that asserted oneprintAbovecall per line sees one call per batch (HeadlessBackend.printAboveCallscounts them). -
Asciicast recording writes on a background thread.
AsciicastRecordernow owns a daemon writer thread:applyqueues,flush()(new) andclose()drain. An I/O failure surfaces at the next frame or atclose()rather than inside the frame that hit it — the run still ends asRunnerError.Handler. A recorder built by hand must be closed, as before, to stop its thread. -
Taskbar progress has states.
TaskbarState(Cleared,Progress,Error,Indeterminate,Paused) withBackend.setTaskbarStateandRunnerHandle.setTaskbarState(both defaulted to the fraction API) andAppServices.taskbarState(signal)— abstract, so a hand-writtenAppServicesdouble addsdef taskbarState(state: Reactive[TaskbarState]): Unit = ().HeadlessBackend.taskbarProgressRequestsis now derived fromtaskbarStateRequests, an indeterminate bar reading asNone. -
LogConsoleElementgained a trailingscrollfield,ErrorBoundaryElementa trailingring,InputElementandwidgets.TextInputa trailingmask— node constructors are not a compatibility surface; the factorieslogConsole(ring, state),errorBoundary(fallback, ring),input(state).masked()andPrompt.password(label, mask = Some("•"))are the spelling.
Migrating to 0.19.0
Style,Layout,RunnerConfigandThemeare nowfinal classes with private constructors, as the "Types that will break when they grow" note promised. Construction through the companionapplywith named arguments (Style(fg = Some(c)),RunnerConfig(tickRate = Some(d)),Layout.horizontal(…)) and every preset (Theme.Dark,Style.Default, the newRunnerConfig.Default) compiles unchanged.copyand pattern extractors are gone:x.copy(field = v)becomesx.withField(v)—Layout.horizontal(3, 4).copy(spacing = 1)→.withSpacing(1),Theme.Dark.copy(glyphs = …)→Theme.Dark.withGlyphs(…),Theme.Dark.copy(name = "mine", loading = …)→Theme.Dark.withName("mine").withLoading(…),Style.Default.copy(modifiers = m)→Style.mods(m). Only construction through a preset orDefaultpluswith*is unaffected by future fields; a call to the companionapplystill needs a recompile when a field is added — theapplyis a construction convenience, not the compatibility surface. They are plain classes now — notProducts and notjava.io.Serializable;productIteratorand friends are gone withcopy.StylegainswithModifiers,withClearedModifiersandwithoutLink.LayoutgainswithSpacing,withFlexandwithoutBetween;Layout.spaced(Spacing)remains the builder forbetween, and an explicitspaced(…)keeps precedence overwithSpacinguntilwithoutBetweenclears it.RunnerConfiggainsRunnerConfig.Defaultand awith*/without*pair for every field (withTickRate/withoutTickRate,withMouseCapture/withoutMouseCapture,withKeyEventTypes/withoutKeyEventTypes,withOnTaskError/withoutOnTaskError,withOnFrame/withoutOnFrame,withOnFrameTiming/withoutOnFrameTiming,withViewport). Itsequals/hashCodeare structural except that the three function-valued fields compare by reference, as before.Themegains one builder per role —withName,withPrimary,withAccent,withMuted,withError,withWarning,withSuccess,withSurface,withBorder,withFocus,withLoading,withMarkdown,withSyntax,withGlyphs.Theme.Dark,Theme.Light,Theme.HighContrast, thegiven Theme.defaultandTheme.detected()are unchanged, and the companionapplykeeps its thirteen named arguments plusglyphs = GlyphSupport.Full.toStringis briefer:Themeprints asTheme(dark)— the name only — andRunnerConfigasRunnerConfig.DefaultorRunnerConfig(tickRate=Some(100 milliseconds), mouseCapture=true)— the non-default fields only.LayoutprintsLayout(Horizontal, List(Length(3)), spacing=0, flex=Start, between=None)instead of the derived positional form.
BarChart,CalendarandLinearSpinnerbundle their optional knobs intoBarChartOptions,CalendarOptionsandLinearSpinnerOptions, matchingChart,DataTable,ScrollbarandOrbitSpinner:BarChart(data, barSet = …)→BarChart(data, BarChartOptions(barSet = …));Calendar(y, m, selected = Some(d), dayStyles = s)→Calendar(y, m, Some(d), CalendarOptions(dayStyles = s))— orCalendar(y, m, options = CalendarOptions(dayStyles = s))whenselectedis left out, since the bundle is the fourth parameter;LinearSpinner(elapsed, style, headStyle, axis = …)→LinearSpinner(elapsed, LinearSpinnerOptions(axis = …, style = …, headStyle = …)). The DSL factoriesbarChart,horizontalBarChart,calendarandlinearSpinnerare unchanged. There is no deprecated delegate for the old constructor shapes: an overloadedapplycannot repeat the primary constructor's defaults, so a delegate would have had to spell out every old parameter by hand.WidgetOptionsDisciplineSpecnow failswidgets.testwhen a widget carries more than eight defaulted constructor parameters without an options bundle;Blockis the one allowlisted deferral.TerminalCapabilities.enabled(support)is deprecated; writesupport.usable.- Input and runtime fixes that may change observed behaviour. A
wake()interrupt (every timer tick or async completion) no longer drops a pending Escape, turns Alt+key into a bare key, or dispatches a terminal reply's tail as keystrokes — a half-read sequence (ESC,ESC O,ESC [ 1 ; 5, an X10 mouse report, a split surrogate pair) is re-queued and re-parsed whole, the escape window is not restarted by the wake, and a wake inside a skipped reply resumes the skip with its length cap intact.HeadlessBackend.wake()now interruptsreadEvent, soPilotworks with anytickRate;HeadlessBackend.idleReadsalso counts a wake that found the queue empty, andpendingEventscounts posted events only.waitForIdlemeans what it did; what changed is latency — a timer or async continuation now reaches the render thread within milliseconds instead of at the next tick poll, so a pilot test that waited on aSignalvalue and then asserted ondrawCount(or any frame-derived state) in the next statement could pass on 0.18.3 by accident and now races the frame. Wait for the frame too:pilot.waitUntil("repaint")(backend.drawCount > before)orwaitForDraws(n). A throwing customBackend.wake()no longer stops a repeating timer silently (it reaches the timer thread's uncaught handler); an uncancelledAsync.everyretires itself on its next firing once its owner has closed; a fatal throwable from the final drain escapesruneven after an earlier failure;RunnerError.messagereports the number of cleanup failures. - Rendering fixes:
Buffer.blitkeeps the owner's style on a cut wide glyph; aCell("")is stored and flushed as a styled one-column blank;ListViewBottomToTop keeps a multi-row item's lines in reading order (a bottom-to-top item that does not fit loses its top lines, and one taller than the viewport shows its bottom);Paragraph.scrollXno longer leaves a one-column gap after a straddling wide glyph — the glyph is dropped whole and the column it would have occupied past the edge stays blank, so rows stay column-aligned as inTextArea;Maskedfalls back to its default glyph for a zero-widthmaskChar. - One import:
Cell,UnderlineStyle,LegendConstraints,ScrollbarSide,SpinDirectionandSignalEqualityare now reachable fromimport io.worxbend.tui.dsl.*.DataTableState.keyed[K]builds a state for a keyed table.
Migrating to 0.18.0
- Async submissions reserve continuation capacity before accepting work. Saturated worker,
owner, or runnerless queues throw
RejectedExecutionExceptionsynchronously instead of accumulating an unbounded backlog. Catch overload at the submission boundary and reduce demand; do not retry in a tight loop. Cancellation suppresses unadmitted callbacks, not blocking I/O. Repeating timers coalesce ticks while a callback is pending or running. See Async and timers. - Builders beneath the last full-screen presentation are no longer evaluated. Keep resource acquisition in lifecycle hooks, not view builders. Eager covered-screen hook state is retained; responsive subtrees that disappear keep their existing reset semantics. See App shell.
RunnerConfigadds opt-inonFrameTiming. Recompile consumers against the updated case-class shape.LatestFrameObserveroffers bounded, serial, latest-frame sampling for slow observers: it drops superseded pending frames and is not a lossless recorder. See Performance and Testing.
Paragraphs now produce wrapped rows incrementally and reuse stable measurements. Tree flattening caches are caller-owned, invalidate on source/expansion changes, and do not force collapsed offscreen children. Procmon reuses its table projection until the immutable sample changes. These remove repeated work; they are not claims of an application-wide speedup.
Migrating to 0.17.0
- Directory trees and file pickers no longer acquire filesystem data while painting.
Load the initial listing explicitly; acquire background snapshots with
DirectoryListing.loadand install them on the owning render thread. See Widgets. - Reactive graphs belong to one live render loop. Capture
RenderThread.capture()before registering an external callback, then dispatch mutations throughowner.execute. See State and signals. - Render queues and shutdown drains have finite callback budgets. Do not depend on an
arbitrarily large backlog completing during shutdown. Optional
Async.scope()groups task cancellation, but does not interrupt blocking I/O. See Async and timers.
This release also fixes deferred keyed state, navigation focus identity, cross-span Unicode rendering, enhanced keyboard restoration, and async error visibility. It adds source-aware table caching and a custom interactive-widget adapter.
Compatibility policy
| Change | Patch release | Minor release before 1.0 |
|---|---|---|
| bug fix preserving signatures | yes | yes |
| additive widget or method | yes, when low risk | yes |
| source-breaking rename/removal | no | possible, documented |
| behavior change with migration work | no | possible, documented |
| raised minimum JDK / toolchain requirement | no | possible, documented |
| binary compatibility guarantee | not yet | not yet |
0.14.0 raises the minimum JDK from 21 to 25: every published artifact declares -release:25, so a class
file built by this version will not load on JDK 21–24 (UnsupportedClassVersionError). Consumers pinned to
an older JDK should stay on 0.13.0 until they can move.
MiMa binary-compatibility gates are planned once a first published baseline is selected. Until then, recompile downstream code on upgrade even when moving between patch versions.
Types that will break when they grow
Adding a field to a case class changes the signatures of apply, copy and
unapply, so downstream code compiled against the old shape fails with
NoSuchMethodError — recompiling fixes it, but only if you know to.
Style, Layout, RunnerConfig and Theme left this category in 0.19.0. Each is a
final class with a private constructor, and its compatibility surface is its presets or
Default plus the with* builders: Style.Default/Style.Reset/Style.fg/bg/of/mods,
Layout.horizontal/vertical (Layout.spaced for between), RunnerConfig.Default, and
Theme.Dark/Light/HighContrast. A value built that way keeps working when a field is
added. Their companion apply keeps today's defaults for convenience but is still
arity-sensitive — adding a field changes its descriptor, so a call to it needs a recompile —
and at that growth the previous arity is kept as a plain default-free overload so compiled
callers keep working. 0.20.0 is the first release to exercise that promise: RunnerConfig
grew three fields (captureStdio, recording, nonInteractive) and turned its mouse Boolean into
a MouseCaptureMode, and keeps a default-free apply for each earlier arity — seven, eight, nine
and ten fields — and
Layout.apply keeps its 0.19.0 five-argument arity beside the new crossAlign parameter.
Theme.apply gained a defaulted components parameter without an overload, so a compiled call
to it needs a recompile; Theme.Dark.with* chains do not.
These public types are still case classes that will grow; each grows only by appending a
defaulted field, so named construction and copy keep compiling, while a positional pattern
over the extractor needs one more binder per field:
| Type | Module | Why it will grow |
|---|---|---|
ElementProps | tui-dsl | every new element modifier lands here |
FrameworkKeys | tui-dsl | every rebindable framework key is a field (six were added in 0.20.0) |
TerminalCapabilities | tui-terminal | every probed terminal feature is a field (eleven were added in 0.20.0) |
Constraint is a sealed enum that grows by cases rather than fields — 0.20.0 added Auto and
Bounded. A match over it that must survive the next case carries a wildcard.
ElementProps stays a case class until the DSL-node step below because its user-facing
surface is already the fluent builders (.fg(…), .length(n), .onKeyEvent(…)), which
keep their shape when a field is added, and nothing published calls its copy. The
genuinely closed value types (Position, Size, Rect, Cell, KeyEvent,
MouseEvent) are expected to stay case classes: their shape is fixed by what a
terminal cell and a coordinate are.
The DSL node types — TextElement, PanelElement and the other *Element case classes
the factories return — are a related surface. Their constructors, copy methods and
pattern extractors are not part of the compatibility contract; the factories (text(…),
panel(…)) and the fluent builders on Element are. A node gains a field whenever its
factory gains an option, so inspect a tree through props, children and widget
rather than pattern-matching a node's constructor. Before 1.0 a node may become a
final class behind its factory with no user-visible change.
Release process
The Maven namespace is com.worxbend, corresponding to the domain worxbend.com.
Before a Central release, verify this namespace under the account whose Portal
token is stored in the publishing secrets. Sonatype checks the verification TXT
record on worxbend.com; see namespace verification.
Scala imports continue to use io.worxbend.tui: the Maven group ID and Scala package
names are independent.
GitHub Packages releases through v0.18.1 used the io.worxbend Maven group.
Consumers moving to the new group must update their dependency coordinates.
The Publish GitHub Packages workflow (.github/workflows/publish-packages.yml)
runs on v* tag pushes and can also be started manually with a version input.
For a manual run, select the ref to publish and supply the version declared by all
seven modules at that ref; the workflow publishes that ref's validated commit.
It calls the complete read-only CI workflow, checks out only its validated SHA,
and verifies every module version before exposing the built-in GITHUB_TOKEN.
Only the publishing job receives packages: write; no additional repository secret
or GPG signing key is needed for GitHub Packages.
The publisher uploads tui-core, tui-terminal, tui-widgets, tui-runtime,
tui-macros, tui-dsl, and tui-test with their POMs, JARs, sources and Scaladoc.
After upload, it downloads all 28 files, checks their hashes against the validated
build, and runs the isolated DSL/macro and test-support consumer using a fresh
Coursier cache and the remote resolver. Missing artifacts or incorrect transitive
dependencies fail the release workflow.
To publish the current main commit manually:
gh workflow run publish-packages.yml --ref main -f version=0.21.0
Treat released versions as immutable. Increment the shared publishVersion
before another release; a manual run is for a version that has not yet been uploaded.
If an upload partially succeeds, inspect the package versions and workflow logs
before retrying.
Releases are Git tags named vX.Y.Z. Pushing a tag runs the Publish workflow. Before
signing credentials are made available, it calls the same read-only CI workflow used
for main and pull requests on the tag's exact commit. Compilation, module and example
tests, formatting/lints, discipline checks, native images, the site build, and packaged
consumer validation must all pass. Publication checks out the validated SHA and refuses
to upload if it differs from the tag commit or if the tag version differs from build.mill.
The packaged-consumer gate stages all seven artifacts in a temporary Maven repository,
checks their coordinates and exact production dependency edges, rejects leaked test
libraries, and builds/runs a consumer outside the source module graph. That consumer
resolves tui-dsl in production and tui-test only in its test configuration, exercises
external derivation and DSL imports, and checks the resolved jars against the staged
artifacts. Run it locally with python3 scripts/verify-packaged-consumer.py; it does not
publish remotely or modify the normal local Maven/Ivy repository.
Only after these gates does Publish upload all seven libraries to Maven Central
with the synchronized version and signed POM metadata. It then waits for the public
repository, downloads all 28 release files without authentication, compares their
hashes, and runs the isolated consumer with a fresh Coursier cache. An accepted
Portal upload alone does not make the workflow successful. The separate Autofix workflow
remains limited to same-repository pull requests; release validation never rewrites the
commit being validated. After Autofix pushes with GITHUB_TOKEN, maintainers must
approve the token-generated full CI run for the resulting PR commit before merging.
The Autofix job's library tests and checks from the previous SHA are not substitutes
for full validation of that commit. If no run appears, create an ordinary maintainer
push to trigger it; do not merge based only on the pre-formatting checks.
Before a tag, maintainers should verify:
- formatter, compile, and complete test suite;
- public guide and Scaladoc changes;
- example JVM runs and native-image CI;
- module version in
build.mill; - migration notes for any source or behavior change.
License
MIT — use glyphora in open-source or commercial software, keeping the copyright and license notice.