io.worxbend.tui.widgets

Members list

Type members

Classlikes

final case class Accordion(sections: Seq[Section], style: Style = ..., openStyle: Style = ..., collapsedSymbol: String = ..., expandedSymbol: String = ...) extends StatefulWidget[AccordionState]

A stack of titled sections of which at most one is unfolded: every header takes one row (▸ title folded, ▾ title open) and the open section's body takes every row the headers leave, between its own header and the next. With nothing open the headers sit at the top. An area shorter than the headers keeps as many as fit, from the top.

A stack of titled sections of which at most one is unfolded: every header takes one row (▸ title folded, ▾ title open) and the open section's body takes every row the headers leave, between its own header and the next. With nothing open the headers sit at the top. An area shorter than the headers keeps as many as fit, from the top.

Titles are clipped by display width. The open header draws in openStyle over style. Stateless apart from the caller-owned AccordionState; render-thread use only.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait StatefulWidget[AccordionState]
class Object
trait Matchable
class Any
Show all
object Accordion

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Accordion.type
final class AccordionState(initialOpen: Option[Int] = ...) extends VersionedState

Caller-owned Accordion state: which section is open, if any. The single-open policy lives here, so the widget and the DSL node built on collapsible cannot disagree about it: opening a section closes whichever was open, and toggling the open one closes it.

Caller-owned Accordion state: which section is open, if any. The single-open policy lives here, so the widget and the DSL node built on collapsible cannot disagree about it: opening a section closes whichever was open, and toggling the open one closes it.

Render-thread-only and Versioned: every mutation raises version, which is how a running app learns it owes a frame.

Attributes

Companion
object
Supertypes
trait VersionedState
trait Versioned
class Object
trait Matchable
class Any

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
object AnimatedText

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
final case class AnimatedText(content: String, elapsed: FiniteDuration, effect: TextEffect = ..., style: Style = ..., highlightStyle: Style = ...) extends Widget, Measured

Text with a time-based effect applied to it, drawn from how long the animation has been running.

Text with a time-based effect applied to it, drawn from how long the animation has been running.

Like every animation here, the frame is a pure function of elapsed, so a test renders any moment directly and the ambient AnimationClock drives it in an app with no counter to thread through.

style is the resting appearance and highlightStyle the emphasised one; an effect uses one, the other, or a blend, according to what it does.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait Measured
trait Widget
class Object
trait Matchable
class Any
Show all
object Badge

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Badge.type
final case class Badge(label: String, variant: BadgeVariant = ..., style: Style = ..., dotSymbol: String = ...) extends Widget, Measured

A short inline label: a status tag, a count, a category.

A short inline label: a status tag, a count, a category.

One row, sized to its content — put it in a row beside the thing it labels. The badge clips rather than wrapping, because a badge that wrapped would stop reading as one.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait Measured
trait Widget
class Object
trait Matchable
class Any
Show all

How a Badge is drawn. The three read at different volumes, which is the point of having three: a solid badge shouts, an outline badge sits inside prose, and a dot is almost silent.

How a Badge is drawn. The three read at different volumes, which is the point of having three: a solid badge shouts, an outline badge sits inside prose, and a dot is almost silent.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class BarChart(data: Seq[(String, Long)], options: BarChartOptions = ...) extends Widget

Bars with labels, one per (label, value), scaled against options.max (defaulting to the data's maximum) and topped with a partial block glyph for sub-cell precision.

Bars with labels, one per (label, value), scaled against options.max (defaulting to the data's maximum) and topped with a partial block glyph for sub-cell precision.

options.direction picks the layout. Vertical — the default, and what this widget has always done — draws upright bars barWidth columns wide with their labels on the row underneath, so each name has only as many columns as its bar. Horizontal draws the bars rightwards, barHeight rows tall, and reserves a gutter down the left edge for the labels: that is the layout to reach for when the category names are long, because a name in the gutter has a whole strip of columns to itself instead of being truncated to a bar's width.

Everything past the data — the layout, the scale, the numbers beside the bars, the styles and the glyph set — rides in options; see BarChartOptions for what each knob does.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
final case class BarChartOptions(direction: Direction = ..., barHeight: Int = ..., barWidth: Int = ..., barGap: Int = ..., max: Option[Long] = ..., showValues: Boolean = ..., valueFormat: Long => String = ..., barStyle: Style = ..., labelStyle: Style = ..., valueStyle: Style = ..., barStyleFor: (Int, Long) => Option[Style] = ..., barSet: BarSet = ...)

Everything about a BarChart that is not the data: the layout, the scale, the numbers beside the bars, and how all of it is styled and drawn.

Everything about a BarChart that is not the data: the layout, the scale, the numbers beside the bars, and how all of it is styled and drawn.

Bundled rather than listed on BarChart itself because the list had grown to twelve optional knobs. Every field keeps the default it had as a BarChart constructor parameter, so BarChartOptions() is exactly the chart the bare constructor drew.

Value parameters

barGap

blank columns (rows, sideways) between neighbouring bars

barHeight

rows per bar; read by the horizontal layout only

barSet

the glyphs the bars are drawn from — BarSet.Ascii for a terminal with no block elements, BarSet.Solid or BarSet.Halves for blunter bars, or a set of your own. Its empty glyph, if it has one, also fills the cells above each bar, which is how the chart gets a visible track behind every bar

barStyle

the style every bar is drawn in unless barStyleFor says otherwise

barStyleFor

restyles individual bars — (_, value) => Option.when(value > limit)(Style.Default.withFg(Color.Red)) paints the bars over a limit red and leaves the rest alone. It is handed the bar's index in data and its value, and what it returns is patched over barStyle, so an override setting only a colour keeps the rest. It colours the bar and nothing else: the label under it and the number beside it keep labelStyle and valueStyle, because those are text a reader has to be able to read whatever the bar is doing. See BarStyling

barWidth

columns per bar; read by the vertical layout only, where it is also all the room a label gets

direction

picks the layout — Vertical (the default) draws upright bars with their labels on the row underneath, Horizontal draws bars rightwards with the labels in a gutter down the left edge

labelStyle

the style of the category labels

max

the top of the scale; None — the default — scales against the largest value in the data, so the tallest bar always reaches the edge of the area

showValues

writes each bar's number beside the bar: above an upright bar, to the right of a sideways one. Written next to the bar rather than inside it because a io.worxbend.tui.core.Buffer cell holds one style, so a number on top of a filled bar would take the bar's colours and could vanish into them. A number with no room — a bar already at the top of the area, or wider than the space left beside it — is left out rather than truncated, because half a number reads as a different number

valueFormat

turns a value into the text showValues writes, which is where a unit or a thousands separator goes

valueStyle

the style of the numbers showValues writes

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object BarGroup

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
BarGroup.type
final case class BarGroup(label: String, bars: Seq[GroupedBar])

A cluster of bars drawn side by side under one shared label — one month, one region, one test run, with a bar per series measured inside it.

A cluster of bars drawn side by side under one shared label — one month, one region, one test run, with a bar per series measured inside it.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object BarSet

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
BarSet.type
final case class BarSet(eighths: Vector[String], empty: Option[String] = ...)

The glyphs a bar or column is drawn from: one for each eighth of a cell it can be filled to, plus what to draw in the cells above the fill.

The glyphs a bar or column is drawn from: one for each eighth of a cell it can be filled to, plus what to draw in the cells above the fill.

A bar chart in a terminal has no pixels to work with, so a bar that is two and a half cells tall is drawn as two full cells and one half-filled one. eighths is the ladder that makes that possible: eighths(n - 1) is the glyph for a cell filled to n eighths, from one eighth up to a whole cell. The default set uses the eight Unicode block elements ▁▂▃▄▅▆▇█, which is why a glyphora bar reads as eight times more precise than its cell height suggests.

Substituting the ladder is what makes the charts work outside that assumption. A terminal or a font with no block elements needs BarSet.Ascii; a design that wants blunt whole-cell bars with no sub-cell precision wants BarSet.Solid or BarSet.Halves.

empty is what fills a cell the bar does not reach. None — the default — leaves those cells exactly as they were, which is what lets a chart be drawn over an existing background; Some(glyph) paints them, which is what gives a chart a visible track behind each bar.

Every glyph must be a single terminal column wide: a bar is measured in whole columns, so a two-column glyph such as a CJK ideograph would spill into the bar next door.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object BarStyling

How a column chart lets one bar look different from the rest.

How a column chart lets one bar look different from the rest.

A chart has a single style/barStyle for all of its bars. Colouring one bar — the reading that broke a threshold, the sample the cursor is on — used to mean splitting the data across two widgets and lining them up by hand. Instead a chart takes an override function: given a bar's index and its value, it answers Some(style) for a bar that should look different and None for one that should not.

The answer is patched over the chart's own style rather than replacing it (see Style.patch), so an override that sets only a foreground colour keeps the chart's background and text attributes. That is what makes (_, value) => Option.when(value > limit)(Style.Default.withFg(Color.Red)) do the obvious thing.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
BarStyling.type
object BigText

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
BigText.type
final case class BigText(content: String, style: Style = ..., pixel: String = ...) extends Widget, Measured

Large banner text drawn with block glyphs from a built-in 3x5 pixel font (A–Z, 0–9, and common punctuation) — the splash-screen and header building block. Unknown characters render as blanks; lowercase maps to uppercase. Each glyph pixel is one terminal cell, glyphs are separated by one blank column.

Large banner text drawn with block glyphs from a built-in 3x5 pixel font (A–Z, 0–9, and common punctuation) — the splash-screen and header building block. Unknown characters render as blanks; lowercase maps to uppercase. Each glyph pixel is one terminal cell, glyphs are separated by one blank column.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait Measured
trait Widget
class Object
trait Matchable
class Any
Show all
final case class Block(titles: Seq[BlockTitle] = ..., borders: Borders = ..., padding: Padding = ..., mergeBorders: MergeStrategy = ..., style: Style = ..., borderStyle: Style = ..., borderType: BorderType = ..., borderSet: Option[BorderGlyphs] = ..., shadow: Option[Shadow] = ..., titleStyle: Style = ...) extends Widget

A bordered box with any number of border titles — the basic chrome widget almost everything else nests inside.

A bordered box with any number of border titles — the basic chrome widget almost everything else nests inside.

Borders are per-side (Borders.Top | Borders.Bottom for a horizontal band, Borders.All for the classic box); corner glyphs appear only where two adjacent sides meet. padding adds blank cells inside the borders, per side. Content belongs in inner(area); rendering the block never touches the interior, so it composes with any content widget drawn after it.

There are two styles, and they do different jobs. style is painted over the whole area — border cells and interior alike — before anything is drawn, which is how a panel gets a background colour of its own against the screen behind it; because it only patches the style of each cell and never its glyph, content already drawn there keeps its text and its foreground colour. borderStyle is then layered on top of it for the border glyphs and the titles, so it only has to say what is different about the frame. A block left at the default style paints no fill at all and behaves exactly as it did before the parameter existed.

titleStyle is a third style, layered over the border's, for the titles alone. Without it the only way to give every caption on a block the same emphasis — bold panel names, a dimmed status line — was to restyle each BlockTitle's io.worxbend.tui.core.Line one at a time and keep them in step by hand. A title's own spans still layer over it, so one word of a caption can differ from the rest.

borderType names one of the built-in frames. borderSet is the escape hatch under it: hand it a BorderGlyphs of your own and it wins over borderType, which is how a frame nothing in the enum describes gets drawn without waiting for the enum to grow a case.

shadow casts an offset drop shadow, which is what makes a dialog or a popup read as floating rather than cut into the screen. Unlike a CSS box shadow it is paid for inside the block's own area — a widget never draws outside the rectangle it is handed — so a block with the default one-cell shadow frames itself one column narrower and one row shorter, and the strip that frees up is the shadow. On an area too small to leave a usable frame the shadow is dropped and the block renders as it would without one.

Titles sharing a border and an alignment are drawn as one run separated by a single space, in the order given. Titles that share a border with different alignments can still collide on a narrow block; the block clips rather than reflows, matching the library-wide silent-clipping philosophy.

mergeBorders decides what happens where this block's border lands on a border that is already in the buffer. The default, MergeStrategy.Replace, overwrites — two panels sharing a column then draw one wall whose corners do not join. Exact and Fuzzy combine the two glyphs instead, so the seam becomes ┬, ┴ or ┼. See MergeStrategy for the difference between them.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
final case class BlockTitle(line: Line, position: TitlePosition, alignment: Alignment)

One caption drawn into a Block's border: what to write, which border to write it on, and where along that border to put it.

One caption drawn into a Block's border: what to write, which border to write it on, and where along that border to put it.

A block may carry several — the common shape is a name at the top left and a status at the bottom right, which needs two. A title never widens the block, and on a side that has a border it costs no content row either: it is written over border cells that are being drawn anyway, so Block.inner is unchanged. On a side with no border there is no such row to borrow, so the block reserves the outermost row for the title and Block.inner starts one row in — otherwise the title would be painted straight over the first line of content.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object BlockTitle

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
BlockTitle.type
final case class BorderGlyphs(horizontalTop: String, horizontalBottom: String, verticalLeft: String, verticalRight: String, topLeft: String, topRight: String, bottomLeft: String, bottomRight: String)

The eight glyphs a Block draws its frame from: four corners, the two vertical sides, and the two horizontal sides.

The eight glyphs a Block draws its frame from: four corners, the two vertical sides, and the two horizontal sides.

The two sides of each axis are kept apart — verticalLeft next to verticalRight, horizontalTop next to horizontalBottom — because several useful frames are not symmetric. A half-cell border drawn with block elements, for instance, has to hug the interior from whichever side it is on: its left edge is ▐ (the right half of the cell) and its right edge is ▌ (the left half). A single vertical glyph cannot say that, so before this record split the two apart those frames could not be expressed at all.

Every glyph is one terminal column wide in all the built-in sets, so choosing a set never changes a block's Block.inner geometry — only its look. A custom set is free to break that rule, but a two-column glyph in a one-column border cell renders torn, so keep to single-column glyphs.

This is a plain immutable value with no rendering state, so one instance can be shared by any number of blocks on any thread.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object BorderGlyphs

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
enum BorderType

The named frame a Block draws itself with — the box-drawing set, the dashed set, or the block-element set that picks its corner and edge glyphs. BorderGlyphs.of turns one of these into the eight glyphs it stands for, and Block(borderSet = ...) takes such a record directly when none of the named sets is the one you want.

The named frame a Block draws itself with — the box-drawing set, the dashed set, or the block-element set that picks its corner and edge glyphs. BorderGlyphs.of turns one of these into the eight glyphs it stands for, and Block(borderSet = ...) takes such a record directly when none of the named sets is the one you want.

Every glyph in every set here is one terminal column wide, so choosing a set never changes a block's Block.inner geometry — only its look.

  • Plain ┌─┐, Rounded ╭─╮, Double ╔═╗, Thick ┏━┓ — the four classic box-drawing weights.
  • Ascii +-+ — plain ASCII, for a terminal or a font with no box-drawing glyphs, and for output that has to survive being pasted somewhere that is not a terminal at all.
  • The six dashed sets — light or heavy, broken into two, three or four dashes per cell — draw a frame that reads as provisional or inactive next to a solid one. Their corners stay solid, because a dashed corner glyph does not exist.
  • QuadrantInside and QuadrantOutside treat each cell as a 2x2 grid of half-cell "pixels", so the frame sits half a cell inside the block's area or half a cell outside it. Two nested blocks drawn one inside and one outside meet with no gap between them.
  • OneEighthWide and OneEighthTall are the "McGugan box", named after Will McGugan: one-eighth block elements pushed right up against the cell edge, which reads as a hairline rather than as a row of glyphs.
  • ProportionalWide and ProportionalTall compensate for a terminal cell being about twice as tall as it is wide, so the frame looks the same thickness horizontally and vertically.
  • Full █ is a solid slab, and Blank draws spaces — the way to give a block a border-styled margin, or to keep a title's border row without any frame under it.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Borders

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Borders.type
final case class Bounds(min: Double, max: Double)

The inclusive range of world coordinates one axis of a Canvas maps onto its grid.

The inclusive range of world coordinates one axis of a Canvas maps onto its grid.

A named pair, because (Double, Double) says nothing about which end is which or what the two numbers are a pair of — the same tuple shape also serves this module for points, sizes and rates, and a function handed the wrong one compiles fine. Bounds is the one that means "the low and high end of an axis", endpoints included.

It is deliberately one-dimensional. Every consumer here — Canvas, Chart, Painter — carries two of them (xBounds, yBounds) and treats the two axes independently: the horizontal mapping never reads the vertical range, so a two-dimensional form would be a pair with no operations of its own. Pairing them at the call site keeps each axis nameable on its own.

A degenerate bound (min == max), or an inverted one, has no mapping onto the grid: the painter drops every paint rather than dividing by zero. Nothing here normalises or rejects such a range — "nothing draws" is the answer the rest of the widget already gives for it.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Bounds

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Bounds.type
final case class Breadcrumb(items: Seq[String], separator: String = ..., style: Style = ..., currentStyle: Style = ..., separatorStyle: Style = ..., ellipsis: String = ...) extends Widget, Measured

A one-row navigation trail — Home › Projects › glyphora — with the last item, the place the user is, drawn in currentStyle.

A one-row navigation trail — Home › Projects › glyphora — with the last item, the place the user is, drawn in currentStyle.

When the trail is wider than its area the middle items fold into a single ellipsis, earliest first, so the first item (where the trail starts) and the items nearest the end (where the user is) stay readable for as long as they can: Home › … › widgets › Breadcrumb, then Home › … › Breadcrumb. Narrower still the first item goes too (… › Breadcrumb), and finally the last item alone is clipped by display width with a trailing ellipsis. Every width is measured through CharWidth, so a CJK label takes two columns per character.

segments and itemAt replay the same fold, so a caller resolving a click lands on exactly the item drawn under the pointer. Stateless and immutable; render-thread use only, like every widget.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait Measured
trait Widget
class Object
trait Matchable
class Any
Show all
object Breadcrumb

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Breadcrumb.type
final case class Button(label: String, style: Style = ...) extends Widget, Measured

A pressable control rendered as [ label ], centered in its area. Stateless — press handling lives with the caller (the DSL element activates on Enter/Space while focused). Measures one row and the bracketed label's display width, which is what a toolbar or a flow lays it out by.

A pressable control rendered as [ label ], centered in its area. Stateless — press handling lives with the caller (the DSL element activates on Enter/Space while focused). Measures one row and the bracketed label's display width, which is what a toolbar or a flow lays it out by.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Measured
trait Widget
class Object
trait Matchable
class Any
Show all
final case class Calendar(year: Int, month: Int, selected: Option[Int] = ..., options: CalendarOptions = ...) extends Widget

A month grid: an optional title row, an optional weekday header, and the day numbers, with an optional highlighted day.

A month grid: an optional title row, an optional weekday header, and the day numbers, with an optional highlighted day.

year and month (1–12) name the month; selected names a day of that month to draw in the highlight style. Everything else — which headers are shown, how the week runs, the language, the surrounding days and the styles — rides in options; see CalendarOptions for what each knob does.

Needs 20 columns (seven three-column day slots, the last one two wide) and one row per header shown plus one row per week the month touches — so up to 8 rows with both headers, and up to 6 with neither. Overflow clips like everything else.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
final case class CalendarOptions(showTitle: Boolean = ..., showWeekdays: Boolean = ..., firstDayOfWeek: DayOfWeek = ..., locale: Locale = ..., showSurroundingDays: Boolean = ..., style: Style = ..., headerStyle: Style = ..., highlightStyle: Style = ..., surroundingStyle: Style = ..., dayStyles: Map[LocalDate, Style] = ...)

Everything about a Calendar that is not the month or the selected day: which headers are shown, how the week runs, the language, the surrounding days, and the styles.

Everything about a Calendar that is not the month or the selected day: which headers are shown, how the week runs, the language, the surrounding days, and the styles.

Bundled rather than listed on Calendar itself because the list had grown to ten optional knobs. Every field keeps the default it had as a Calendar constructor parameter, so CalendarOptions() is exactly the grid the bare constructor drew.

Value parameters

dayStyles

gives individual dates their own appearance — a date with an appointment, a public holiday, today, every day of a streak. Keyed by java.time.LocalDate rather than by day-of-month so a caller can hold one map across several months and hand the same value to each grid. A date's style is layered over the calendar's style, and highlightStyle over that in turn: a marked day that is also the selected day reads as selected first

firstDayOfWeek

the weekday of the leftmost column, so a US-facing application asks for DayOfWeek.SUNDAY and gets a Sunday-first grid with the day numbers moved to match

headerStyle

the style of the title and the weekday row

highlightStyle

layered over the selected day's style, last, so the cursor stays visible wherever it lands

locale

the language of the month name and the weekday abbreviations. Locale.ENGLISH rather than Locale.getDefault, deliberately: a widget whose output depends on the machine it runs on cannot be tested by comparing frames, and a caller who wants the machine's locale can pass Locale.getDefault and mean it

showSurroundingDays

fills the leading and trailing cells of the grid with the days of the months either side, drawn in surroundingStyle so they read as context rather than as part of this month. They are never selectable: selected names a day of the month being shown

showTitle

whether the July 2026 row is drawn. Switched off, the row is not reserved at all, so the first week moves up — which is what makes a bare month grid usable in a narrow sidebar

showWeekdays

whether the Mo Tu We … row is drawn; switched off, its row goes to the grid too

style

the style of the day numbers of the month shown

surroundingStyle

the style of the surrounding days — dimmed by default

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Canvas(xBounds: Bounds, yBounds: Bounds, shapes: Seq[Shape], labels: Seq[CanvasLabel] = ..., marker: String = ..., resolution: CanvasResolution = ...) extends Widget

A free-form drawing surface: shapes describe themselves in a world coordinate system (xBounds right-ward, yBounds up-ward) and the canvas maps them onto its cell grid, at whichever CanvasResolution it was given.

A free-form drawing surface: shapes describe themselves in a world coordinate system (xBounds right-ward, yBounds up-ward) and the canvas maps them onto its cell grid, at whichever CanvasResolution it was given.

marker is read only at CanvasResolution.Cell, where there is one dot per cell; a marker that is not exactly one column wide is replaced by Marker.Dot rather than allowed to smear into the next cell.

labels pins pieces of text to world coordinates — a city on a map, a threshold on a plot — and, like the shapes, is content rather than appearance, so it sits with the data ahead of the drawing configuration. Labels are drawn after every shape, so a dot cannot land on top of the text that names it.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
final case class CanvasLabel(x: Double, y: Double, line: Line)

A piece of text pinned to a world coordinate on a Canvas — a city on a map, a threshold on a plot.

A piece of text pinned to a world coordinate on a Canvas — a city on a map, a threshold on a plot.

The (x, y) is in the canvas's own coordinate system, the same one shapes speak, with y pointing up. That is what makes a label worth having over writing the text yourself next to the canvas: when the bounds change, the label moves with the thing it names instead of staying where you put it.

Text lands at whole-cell granularity whatever the CanvasResolution is, because there is no half of a cell for a character to sit in: the label starts in the cell containing the point and runs right, clipped at the canvas's own right edge.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

How many drawable sub-pixels one terminal cell contributes to a Canvas.

How many drawable sub-pixels one terminal cell contributes to a Canvas.

The cases trade resolution against how likely a terminal's font is to have the glyphs. Roughly, in descending order of safety: Cell and HalfBlock work everywhere, Quadrant and Braille work almost everywhere, Sextant needs a font from 2020 or later, and Octant one from 2024 or later. A missing glyph shows as the terminal's replacement box, so pick the finest resolution you are willing to see fail.

Resolution is not the only difference. Braille draws sparse dots with gaps between them, which reads as a line; the block-drawing cases fill their whole sub-pixel, which reads as a solid area. For a filled chart the block cases look better even at the same dot count, which is why Octant exists next to Braille at the identical 2×4.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Chart(datasets: Seq[Dataset], xBounds: Bounds, yBounds: Bounds, options: ChartOptions = ...) extends Widget

An x/y chart with drawn axes; the plot region is a Canvas over the datasets' shapes.

An x/y chart with drawn axes; the plot region is a Canvas over the datasets' shapes.

With options.showLabels the two y bounds are printed in a gutter reserved to the left of the vertical axis, and the axis moves right by the width of the widest of them. Before that gutter existed the labels were written at the first plot column, so a four-digit bound painted over the leftmost points of every series; now the numbers and the data never share a cell. options.labelAlignment places a label inside that gutter: Right (the default) presses it against the axis line, Left against the frame, Center between the two.

With options.showLegend the plot's top-right corner carries a key: one entry per dataset with a non-empty name, each drawn in that dataset's own style, so several series in one plot can be told apart by more than colour alone. The key is drawn over the plot, so it costs the data no space — but only while it stays small: options.hiddenLegendConstraints carries (horizontal, vertical) limits and the whole key is dropped unless it satisfies both. The default allows it a quarter of the plot in either direction, so a chart that shrinks loses its key and keeps its data.

options.xTitle and options.yTitle name what the axes measure — the units a plotted series otherwise leaves the reader to guess. Each takes a row of its own: the y title on the row above the plot, starting at the axis column, and the x title on the row below the axis, right-aligned at the axis's far end. The rows are taken from the plot rather than written over it, so a title can never cover a point.

options.xLabels names positions along the horizontal axis — timestamps, dates, category names — on a row taken from the plot just under the axis, above the x title if there is one. They are spread across the plot's columns rather than placed at data coordinates: the first sits at the left end of the axis, the last at the right end, and any in between are centred on their own even share of the width. Three labels therefore read as start, middle and end of the range, which is what the two y bounds already do for the vertical axis. A label that does not fit, or that would touch the label before it, is left out rather than truncated into a different-looking number.

options.yLabels does the same for the vertical axis, and where it is non-empty it replaces the pair of numbers options.showLabels prints rather than adding to them: an axis with two descriptions of itself has none. The labels are spread bottom-to-top — the first sits on the axis's own row, the last on the top row of the plot, and any in between fall on their own even share of the rows — and each is right-aligned against the vertical rule inside the same gutter showLabels uses, which grows to the widest of them. A label that would not leave at least two columns of plot is dropped along with the gutter, so a chart in a narrow pane stays a chart rather than becoming a column of numbers.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
final case class ChartOptions(axisStyle: Style = ..., marker: String = ..., resolution: CanvasResolution = ..., showLabels: Boolean = ..., labelAlignment: Alignment = ..., showLegend: Boolean = ..., hiddenLegendConstraints: LegendConstraints = ..., legendMarker: String = ..., xTitle: Option[String] = ..., yTitle: Option[String] = ..., xLabels: Seq[String] = ..., yLabels: Seq[String] = ...)

Everything about a Chart that is not its data or its world bounds: how the axes, labels, legend and titles are drawn.

Everything about a Chart that is not its data or its world bounds: how the axes, labels, legend and titles are drawn.

Bundled rather than listed on Chart itself because the list had grown to thirteen optional knobs — past the point where a positional call site says what it means. Every field keeps the default it had as a Chart constructor parameter, so ChartOptions() is the chart 0.14.0 drew by default.

Value parameters

axisStyle

the style of the two axis rules, the bound labels, the axis titles and the x-label row

hiddenLegendConstraints

(horizontal, vertical) limits the legend must satisfy or the whole key is dropped. The default allows it a quarter of the plot in either direction, so a chart that shrinks loses its key and keeps its data. See LegendConstraints

labelAlignment

where a label sits inside that gutter: Right (the default) presses it against the axis line, Left against the frame, Center between the two

legendMarker

the glyph each legend entry starts with

marker

the marker datasets are plotted with at CanvasResolution.Cell; a dataset may override it — see Dataset

resolution

the drawing resolution datasets are plotted at; a dataset may override it — see Dataset

showLabels

whether the two y bounds are printed in a gutter reserved to the left of the vertical axis

showLegend

whether the plot's top-right corner carries a key with one entry per named dataset

xLabels

labels spread across the horizontal axis — timestamps, dates, category names — on a row under it; see Chart

xTitle

names what the horizontal axis measures, right-aligned on a row taken from below the axis

yLabels

labels spread bottom-to-top along the vertical axis, replacing the two numbers showLabels prints; see Chart

yTitle

names what the vertical axis measures, on a row taken from above the plot

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Checkbox(label: String, checked: Boolean, style: Style = ..., checkedSymbol: String = ..., uncheckedSymbol: String = ...) extends Widget

A labeled checkbox. Stateless — the checked flag lives with the application (typically in a Signal).

A labeled checkbox. Stateless — the checked flag lives with the application (typically in a Signal).

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
final case class Clear(style: Style = ...) extends Widget

Blanks every cell of its area, so whatever is drawn after it sits on a clean background.

Blanks every cell of its area, so whatever is drawn after it sits on a clean background.

This is the first half of the popup idiom. A dropdown, toast, autocomplete list or dialog drawn over an already-composed frame would otherwise show the content underneath through its own gaps — a menu row shorter than the popup is wide leaves the page text visible to the right of it. Render Clear into the popup's rect first, then render the popup into the same rect.

style is what the blanks carry: Style.Default erases to the terminal's own background, while a style with a background colour paints an opaque panel. Only the area given to render is touched, and only the part of it that falls inside the buffer; everything else is left exactly as it was.

The widget owns no state and claims no size — it fills whatever rect it is handed, which is why it composes with any container.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
trait Clipboard

Where an editor's cut, copy and paste go. The caller supplies one — a widget never reaches for a system clipboard on its own, because it has no terminal: the DSL hands its text nodes one that copies through OSC 52 and pastes from an in-app buffer, and a plain unit test passes Clipboard.inMemory.

Where an editor's cut, copy and paste go. The caller supplies one — a widget never reaches for a system clipboard on its own, because it has no terminal: the DSL hands its text nodes one that copies through OSC 52 and pastes from an in-app buffer, and a plain unit test passes Clipboard.inMemory.

Called on the render thread, from inside an edit.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object Clipboard

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Clipboard.type

One channel of an RGB colour, in the order a ColorPicker in ColorPickerMode.Rgb lists its fields.

One channel of an RGB colour, in the order a ColorPicker in ColorPickerMode.Rgb lists its fields.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object ColorPicker

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
final case class ColorPicker(showCaption: Boolean = ..., mode: ColorPickerMode = ..., style: Style = ..., markerStyle: Style = ..., highlightStyle: Style = ..., invalidStyle: Style = ...) extends StatefulWidget[ColorPickerState], Measured

A palette grid over the 256 xterm colours: the sixteen system colours, the 6×6×6 cube, and the 24-step grey ramp, each swatch two cells wide in its own background, with [] on the cursor's swatch and an optional caption row under the grid naming the index and its approximate RGB value — 196 #ff0000.

A palette grid over the 256 xterm colours: the sixteen system colours, the 6×6×6 cube, and the 24-step grey ramp, each swatch two cells wide in its own background, with [] on the cursor's swatch and an optional caption row under the grid naming the index and its approximate RGB value — 196 #ff0000.

The grid is ColorPicker.Grid: 16 rows, the longest 18 swatches, so the picker measures 36 columns by 17 rows (16 without the caption) and clips like anything else in less. In ColorPickerMode.Palette the chosen value is a Color.Indexed, which every 256-colour terminal draws exactly as the swatch looked. In ColorPickerMode.Rgb a column of three fields — R [255], G [ 0], B [ 0] — and a preview swatch of their colour sit two columns to the right of the grid (45 columns in all); the focused field is drawn in highlightStyle and an invalid one in invalidStyle, and the preview is blank while any field is invalid.

Value parameters

highlightStyle

layered over the RGB field that has the keyboard

invalidStyle

layered over an RGB field that is empty or past 255

markerStyle

the [] marker's style, layered over the swatch's background; its foreground defaults to black or white, whichever stands out against the swatch

mode

palette only, or palette plus RGB entry fields; see ColorPickerMode

showCaption

whether the caption row is drawn under the grid

style

the caption's and the RGB fields' style

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait Measured
trait StatefulWidget[ColorPickerState]
class Object
trait Matchable
class Any
Show all

Which part of a ColorPicker has the keyboard: the palette grid, or one of the RGB fields beside it.

Which part of a ColorPicker has the keyboard: the palette grid, or one of the RGB fields beside it.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

How a ColorPicker lets the user pick, and what it chooses.

How a ColorPicker lets the user pick, and what it chooses.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final class ColorPickerState(initial: Int = ...) extends VersionedState

Caller-owned state of a ColorPicker: the palette index under the cursor, the three RGB entry fields, which part has the keyboard, and the colour last chosen.

Caller-owned state of a ColorPicker: the palette index under the cursor, the three RGB entry fields, which part has the keyboard, and the colour last chosen.

The cursor moves over ColorPicker.Grid, so Up/Down keep the column where the row is long enough and clamp to the row's last swatch where it is not, and no move wraps. Every grid move refills the RGB fields from the swatch's approximate value and gives the keyboard back to the grid. An RGB field holds up to three typed digits; it is valid when it is non-empty and at most 255, and chooseRgb chooses only while all three are. The first digit typed into a field that still shows the grid's value replaces that value rather than appending to it.

Render-thread-only. Every mutation raises version (see io.worxbend.tui.core.Versioned), so a write made outside the event path is painted too, with no Signal write.

Value parameters

initial

the xterm palette index the cursor starts on, clamped to 0..255

Attributes

Supertypes
trait VersionedState
trait Versioned
class Object
trait Matchable
class Any
final case class ColorRamp(stops: Vector[Color])

A color gradient sampled by a fraction in [0, 1] — what a progress bar uses to color its fill by how far along it is.

A color gradient sampled by a fraction in [0, 1] — what a progress bar uses to color its fill by how far along it is.

A named type rather than a (Color, Color) pair for two reasons: a tuple does not say which end is which, and two stops cannot express the most common progress ramp of all. Green through amber to red is three stops, and interpolating straight from green to red passes through a muddy brown rather than through amber.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object ColorRamp

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
ColorRamp.type
final case class Column(items: Seq[LayoutItem], spacing: Int = ..., flex: Flex = ..., crossAlign: CrossAlign = ...) extends Widget, Measured

Lays its items out top-to-bottom using the core constraint solver and renders each into its segment.

Lays its items out top-to-bottom using the core constraint solver and renders each into its segment.

An item constrained Constraint.Auto gets the rows its widget measures through Measured.heightAt, and each item is placed across the column by its own align, or by crossAlign when it sets none — see Row, which this mirrors one axis over.

Measurement: a column is as tall as its items plus the gaps between them, where an item's height is its Length when it has one and its widget's own measurement otherwise; any item that can say neither makes the column unmeasurable. It is as wide as its widest measurable item.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Measured
trait Widget
class Object
trait Matchable
class Any
Show all
final case class ColumnSort(column: Int, direction: SortDirection)

A column index paired with the direction it is sorted in.

A column index paired with the direction it is sorted in.

The two travel together because neither means anything alone: a direction with no column says nothing at all, and before this pairing existed an unsorted table still carried an ascending flag that could be flipped — changing the memoization key, and so recomputing an identical view.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object ContextMenu

Where a context menu goes: a Menu whose top-left corner is the cell that was clicked, flipped to end at that cell instead on any axis where it would run past frame — so a menu opened near the right edge opens to the left of the pointer, one opened near the bottom opens upwards — then clipped to the frame.

Where a context menu goes: a Menu whose top-left corner is the cell that was clicked, flipped to end at that cell instead on any axis where it would run past frame — so a menu opened near the right edge opens to the left of the pointer, one opened near the bottom opens upwards — then clipped to the frame.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
final class ContextMenuState extends Versioned

Caller-owned state of a context menu: where it was opened — the screen cell the right click landed on — while it is open, and the highlight inside it (a MenuState).

Caller-owned state of a context menu: where it was opened — the screen cell the right click landed on — while it is open, and the highlight inside it (a MenuState).

Render-thread-only and Versioned: version is its own mutation count plus the menu state's.

Attributes

Companion
object
Supertypes
trait Versioned
class Object
trait Matchable
class Any
object DataTable

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
DataTable.type
final case class DataTable[K](columns: Seq[String], rows: Seq[KeyedRow[K]], widths: Seq[Constraint], options: DataTableOptions = ...) extends StatefulWidget[DataTableState[K]]

A sortable, filterable table with a selectable, scrollable body — Table plus the interaction a data grid needs.

A sortable, filterable table with a selectable, scrollable body — Table plus the interaction a data grid needs.

The header shows a ▲/▼ indicator on the sorted column; the filter keeps rows where any cell contains the text (case-insensitive); sorting compares numerically when both cells parse as numbers, else as text.

Each row is a KeyedRow: cells is what the table sorts, filters and draws, and key is the row's stable identity. The selection follows the key across re-sorts and data refreshes — see DataTableState — and selectedKey reads it back, so an app never has to parse its own formatted cells to recover which record is selected. DataTable.fromStrings builds a table from plain text rows, keying each by its original position, for callers that have no record identity of their own.

Type parameters

K

the row key type; Int (the row's original position) for a table built by DataTable.fromStrings

Value parameters

columns

the column titles; the header settles how many columns the table has

rows

the body rows — see KeyedRow for the key's contract. Any sequence; a TableRows provider for data that should be read a row at a time rather than held in memory

widths

one Constraint per column. An empty sequence means "equal columns": each of the columns titles gets an equal share of the area. Before that fallback existed an empty sequence drew a blank rectangle instead.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait StatefulWidget[DataTableState[K]]
class Object
trait Matchable
class Any
Show all
final case class DataTableOptions(footer: Option[Seq[String]] = ..., columnSpacing: Int = ..., flex: Flex = ..., alignments: Seq[Alignment] = ..., multiLine: Boolean = ..., style: Style = ..., headerStyle: Style = ..., footerStyle: Style = ..., highlightStyle: Style = ..., columnHighlightStyle: Option[Style] = ..., cellHighlightStyle: Option[Style] = ..., cellStyle: (Seq[String], Int) => Style = ..., highlightSymbol: String = ...)

Everything about a DataTable that is not its columns, rows or widths: layout, looks, and the per-cell styling hook.

Everything about a DataTable that is not its columns, rows or widths: layout, looks, and the per-cell styling hook.

Bundled rather than listed on DataTable itself because the list had grown to twelve optional knobs. Every field keeps the default it had as a DataTable constructor parameter, so DataTableOptions() is the table 0.14.0 drew by default.

Value parameters

alignments

where each column's text sits inside its own column, by position: alignments(0) places column 0, alignments(1) column 1, and so on. This is how a numeric column lines up on its last digit instead of on its first. It applies to the header caption, the body cells and the footer alike, so a right-aligned column's title stays over its figures. The sequence may be shorter than the column list, or empty — the default — and every column it does not reach is left-aligned, which is what every column did before this parameter existed. A short sequence is allowed on purpose: a table gains a column far more often than it changes an alignment, and a length check that threw from inside the render loop would be the worst way to find that out. Entries past the last column are ignored. A Table takes no such parameter because its cells are io.worxbend.tui.core.Lines, which carry their own alignment (Line.raw("42").rightAligned). A DataTable cell is a bare String — it has to be, because the widget sorts and filters on the text — so the placement has nowhere to live except here.

cellHighlightStyle

layered on last, over the cell where the selected row and the selected column meet. Painting it after both means the intersection can be told apart from the row and the column that cross there, which is the whole point of having three styles rather than one.

cellStyle

the style of one body cell, given the row's own cells and the column index, layered over everything the widget itself decided: the table style, the selection highlight if that row is selected, and the column and cell cursors if they are on it. That ordering means a red FAILED cell stays red under the selection bar instead of the two fighting over the same cell, and it is why this returns a patch rather than a whole style. It is asked about the row's contents rather than about the row's position because filtering, sorting and paging all move rows around between frames: an index identifies a different record after every sort, and a caller reading one would colour whatever record happened to land there. The header and footer never consult it — headerStyle and footerStyle own those rows — and neither does the reserved highlightSymbol gutter. The default returns an empty style, which patches nothing, so a table that does not set it renders exactly as it did before this parameter existed.

columnHighlightStyle

layered over the row's style for every body cell in the selected column, or None — the default — to draw no column cursor at all. Together with cellHighlightStyle this is what turns a row-selecting table into a spreadsheet-style grid cursor; a table that sets neither renders exactly as it did before they existed.

columnSpacing

columns of padding between two solved column widths

flex

where the columns sit when they do not fill the area — see Table for the full explanation. The reserved highlightSymbol gutter is taken off the left first, so the flex distributes only what is left over after it.

footer

an optional summary row — totals, a record count — pinned to the bottom of the area rather than following the last data row, and laid out on the same solved columns as the body. It costs one row of the scrollable body. A DataTable always draws its header, so the footer is dropped on an area only one row tall, where the header has already taken the only row there is.

footerStyle

the style the footer row is drawn in, bold by default, matching the header

headerStyle

the style of the header row, bold by default

highlightStyle

layered over the selected row's style

highlightSymbol

text drawn to the left of the selected row, in a gutter reserved for it on every row so the columns do not jump as the selection moves. highlightStyle alone marks the selection by reversing the row's colours, which two kinds of terminal do not show: one that ignores reverse video, and one where the row already carries a background colour of its own that the reversal blends into. A symbol survives both. The default is "" — an empty symbol reserves a zero-width gutter, so a table written before this parameter existed draws exactly the same cells in exactly the same columns as before. ListView defaults to "> " instead, because a list has no column grid to keep still.

multiLine

lets a body cell span rows: a \n in a cell starts another row of the same record, and the record is as tall as its tallest cell, shorter cells left blank below. Scrolling, the selection highlight and rowAt count those rows. Off by default, when every record is one row whatever its cells hold. Measuring a record reads it, so over a TableRows provider the rows around the window are read as well as the window itself.

style

the style of the whole table

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
final class DataTableState[K] extends VersionedState

Caller-owned DataTable state: the sort (if any), a substring filter, selection, scroll, and paging (if any).

Caller-owned DataTable state: the sort (if any), a substring filter, selection, scroll, and paging (if any).

Selection indexes into the view (the filtered, sorted rows) — use DataTable.visibleRows to map it back to data.

Every render also records the selected row's key, and the next render re-anchors the selection to wherever that key landed after a re-sort or a data refresh — the highlight follows the record rather than the row number. Every selection mutator here, and every direct selected = … assignment, clears the recorded key; DataTable.selectKey sets both at once.

The state is typed on the table's key type so the recorded key and the memoized view never leave it: one state instance belongs to one DataTable shape, which is how it was already used — sharing a state between tables with different row data never meant anything.

Render-thread-only. Every mutation raises version (see io.worxbend.tui.core.Versioned), so a DSL node that paints this state notices a write made outside the event path — a background result applied on the render thread — and schedules the frame that shows it, with no Signal write and no requestRedraw().

Type parameters

K

the key type of the table's KeyedRows; Int — the row's original position, which is what DataTable.fromStrings keys by — for a table built from plain text rows, whose state is still spelled DataTableState() (see the companion).

Attributes

Companion
object
Supertypes
trait VersionedState
trait Versioned
class Object
trait Matchable
class Any
final case class Dataset(name: String, points: Seq[(Double, Double)], graphType: GraphType = ..., fillToY: Double = ..., resolution: Option[CanvasResolution] = ..., style: Style = ..., marker: Option[String] = ...)

One plotted series: points in world coordinates, drawn the way graphType says.

One plotted series: points in world coordinates, drawn the way graphType says.

fillToY is the baseline the Bar and Area graph types measure from, in the data's own units. It defaults to zero, which is what a count or a rate is measured against; set it when the meaningful floor is elsewhere — a temperature series against 20.0, say — so the filled region shows the departure from that level rather than from an origin the reader does not care about. The other graph types ignore it.

resolution and marker override the chart-wide pair for this one series; None, the default, means "whatever the chart says". That is how a braille line and a cell-resolution scatter share one plot, a difference colour alone cannot make on a monochrome terminal. Series that end up with the same pair are drawn together in one pass; series with different pairs are drawn in separate passes, in the order those pairs first appear in datasets, so where two groups claim the same cell the later one wins. That order is fixed rather than left to a hash, because two runs of the same chart disagreeing about which series is on top would be a frame nobody could pin down.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class DatePicker(options: CalendarOptions = ..., selectedStyle: Style = ..., disabledStyle: Style = ...) extends StatefulWidget[DatePickerState]

An interactive month grid: Calendar showing whichever month DatePickerState.cursor is in, with the cursor day in options.highlightStyle and the chosen date, when it is not under the cursor, in selectedStyle.

An interactive month grid: Calendar showing whichever month DatePickerState.cursor is in, with the cursor day in options.highlightStyle and the chosen date, when it is not under the cursor, in selectedStyle.

The widget only draws; the keys — arrows move a day or a week, PageUp/PageDown a month, t jumps to today, Enter chooses — are the DSL's datePicker node calling the state's methods. Needs the 20 columns and up to 8 rows a Calendar needs, and clips like one.

Value parameters

disabledStyle

layered over the days outside the state's min..max, which the cursor cannot reach

options

the grid's headers, week start, locale and styles, exactly as a Calendar takes them. Any dayStyles given here still apply; the chosen date's style is layered over its entry

selectedStyle

marks the chosen date while the cursor is elsewhere

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait StatefulWidget[DatePickerState]
class Object
trait Matchable
class Any
Show all
final class DatePickerState(initial: LocalDate, today: () => LocalDate = ..., val min: Option[LocalDate] = ..., val max: Option[LocalDate] = ...) extends VersionedState

Caller-owned state of a DatePicker: the date under the cursor, and the date the user last chose.

Caller-owned state of a DatePicker: the date under the cursor, and the date the user last chose.

The cursor is a whole LocalDate, not a day of a fixed month, so moving it past the end of a month simply lands in the next one — Right on the 31st of July is the 1st of August — and the picker's grid follows it. A move that would leave the range LocalDate can represent leaves the cursor where it is rather than throwing.

Render-thread-only. Every mutation raises version (see io.worxbend.tui.core.Versioned), so a write made outside the event path is painted too, with no Signal write.

Value parameters

initial

where the cursor starts With min or max set the cursor never leaves the range they bound: every move, goToToday and a direct write to cursor clamp to the nearer bound, so a date outside it can never be chosen. The picker draws such days in its disabledStyle and a click on one does nothing.

max

the latest date the cursor may reach, inclusive; None for no upper bound. A max before min leaves only min reachable

min

the earliest date the cursor may reach, inclusive; None for no lower bound

today

the clock goToToday reads; injectable so a test does not depend on the day it runs

Attributes

Supertypes
trait VersionedState
trait Versioned
class Object
trait Matchable
class Any
final case class Dialog(title: String, message: Text, buttons: Seq[String] = ..., selectedButton: Int = ..., style: Style = ..., highlightStyle: Style = ..., borderType: BorderType = ...) extends Widget

A modal-style dialog drawn over existing content: clears a centered box, borders it, renders the message and a row of buttons with one highlighted.

A modal-style dialog drawn over existing content: clears a centered box, borders it, renders the message and a row of buttons with one highlighted.

The widget owns no state and manages no stack of its own — it paints over whatever was drawn into the buffer before it, so rendering it last in the view is what makes it modal-looking. The DSL's Screen stack (TuiApp.pushScreen) builds on exactly that.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
enum DiffLayout

How a DiffView lays a hunk out: one column with - lines above their + replacements (Unified, what git diff prints), or the old file on the left and the new one on the right with a replaced line beside its replacement (Split).

How a DiffView lays a hunk out: one column with - lines above their + replacements (Unified, what git diff prints), or the old file on the left and the new one on the right with a replaced line beside its replacement (Split).

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
enum DiffLine(val text: String)

One line of a Hunk: unchanged context, a line only the new side has, or a line only the old side had. text is the line without its ' '/'+'/'-' marker and without a line terminator.

One line of a Hunk: unchanged context, a line only the new side has, or a line only the old side had. text is the line without its ' '/'+'/'-' marker and without a line terminator.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Known subtypes
class Context
class Added
class Removed
final case class DiffView(patch: Patch, options: DiffViewOptions = ...) extends StatefulWidget[DiffViewState], Measured

A unified diff, drawn as git diff prints it or side by side — the review pane of a coding agent, a commit browser, a "what changed" panel. patch comes from Patch.parse (git's own output) or Patch.of (two texts).

A unified diff, drawn as git diff prints it or side by side — the review pane of a coding agent, a commit browser, a "what changed" panel. patch comes from Patch.parse (git's own output) or Patch.of (two texts).

Each file with a path is headed by it (old → new for a rename), each hunk by its @@ line, and each line carries its old and new line numbers. Unified mode lists a change's removed lines above its added ones; split mode puts the old side left of the DiffViewOptions.separator and the new side right of it, a replaced line beside its replacement and the longer side of an uneven change against blank rows. Columns are measured with io.worxbend.tui.core.CharWidth, so CJK and emoji keep both halves aligned; a line too long for its column is clipped. See DiffViewOptions for folding context, word highlighting and syntax highlighting.

Scrolling and hunk navigation live in the caller-owned DiffViewState; the widget value is immutable. It measures its height — one row per header, line and folded run — through Measured.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Measured
trait StatefulWidget[DiffViewState]
class Object
trait Matchable
class Any
Show all
final case class DiffViewOptions(layout: DiffLayout = ..., lineNumbers: Boolean = ..., contextLines: Option[Int] = ..., wordHighlight: Boolean = ..., lexer: Option[Lexer] = ..., lexerFromPath: Boolean = ..., style: Style = ..., insertedStyle: Style = ..., deletedStyle: Style = ..., insertedEmphasis: Style = ..., deletedEmphasis: Style = ..., fileHeaderStyle: Style = ..., hunkHeaderStyle: Style = ..., lineNumberStyle: Style = ..., collapsedStyle: Style = ..., syntaxTheme: SyntaxTheme = ..., separator: String = ..., collapsedGlyph: String = ..., approximateNotice: String = ...)

Everything about a DiffView past the patch it draws; DiffViewOptions() is the plain unified view.

Everything about a DiffView past the patch it draws; DiffViewOptions() is the plain unified view.

contextLines = Some(n) keeps n unchanged lines next to each change and folds every longer run of context into a single … 12 unchanged lines row — the way to show a Patch.of computed with a large context without the reader scrolling past the whole file; None shows every context line the patch holds. wordHighlight marks, on a removed line and the added line that replaced it, the words that actually changed, in the *Emphasis styles. This optional emphasis is skipped above 16384 UTF-16 units per line, 2048 tokens per line or 256 word edits; the ordinary line tint remains, and a generated one-line replacement cannot exhaust the render thread's word-diff budget. lexer highlights the text of every line through a Lexer in syntaxTheme, with the line's inserted or deleted style underneath, so a theme whose insertedStyle is a background keeps the syntax colours on top of it. With no lexer, lexerFromPath picks one per file from the extension of the path in its header (.scala, .ts, .py, .yaml, …, through Lexer.forName); a file with no path or an extension no built-in lexer claims is drawn unhighlighted. Each line is lexed on its own — a block comment spanning lines is not followed across them.

Styles: style is the base of the whole view; insertedStyle/deletedStyle colour added and removed lines, marker included; the emphasis styles are laid over those for changed words; the rest colour the file and hunk headers, the line-number gutter (and the split view's divider) and the folded-context rows. separator is the split view's divider and collapsedGlyph leads a folded-context row; approximateNotice is the first row of a patch marked Patch.approximate.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final class DiffViewState extends Versioned

Caller-owned DiffView state: the scroll offset (the first visible row), hunk navigation, which folded context runs the reader expanded, and the horizontal scroll of the line text.

Caller-owned DiffView state: the scroll offset (the first visible row), hunk navigation, which folded context runs the reader expanded, and the horizontal scroll of the line text.

nextHunk and previousHunk put a hunk's header on the top row, even when that leaves blank rows below the last hunk — a reader stepping through hunks wants each one at the same place. expandAt opens the folded run on a laid-out row (what a click on it does), expandFirstVisible the first one on screen (what Enter does), and collapseAll folds them again. scrollRight and scrollLeft move every line's text sideways by columns — the gutter, the markers and the headers stay put — up to the widest line. The rows of the hunks and the size of the viewport are recorded by the most recent render, so every move is a no-op before the first frame. The state also keeps the laid-out rows of the last patch it drew, so a view redrawn every frame does not diff its changed lines again until the patch (by reference), the options or the expanded runs change.

Render-thread-only. Every mutation raises version (see io.worxbend.tui.core.Versioned), so a DSL node that paints this state notices a write made outside the event path and schedules the frame that shows it. The scrolling itself — offset, clamp, page moves — is a ScrollViewState inside, so a diff and a scroll view page alike.

Attributes

Supertypes
trait Versioned
class Object
trait Matchable
class Any
final case class DirectoryEntry(path: Path, isDirectory: Boolean, identity: Path)

Immutable entry metadata. Directory identities must be resolved before publication, never during painting.

Immutable entry metadata. Directory identities must be resolved before publication, never during painting.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
final case class DirectoryListing(directory: Path, identity: Path, entries: Vector[DirectoryEntry])

An immutable filesystem snapshot, safe to acquire on a worker and pass back to its owning render thread. Links are followed, including outside the root; this browser is not a filesystem sandbox.

An immutable filesystem snapshot, safe to acquire on a worker and pass back to its owning render thread. Links are followed, including outside the root; this browser is not a filesystem sandbox.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final class DirectoryLoadRequest

A caller-owned acquisition generation. Create on the render thread, use off-thread, install on the owner thread.

A caller-owned acquisition generation. Create on the render thread, use off-thread, install on the owner thread.

Attributes

Supertypes
class Object
trait Matchable
class Any

Observable acquisition state; failure stays failed until explicitly retried or invalidated.

Observable acquisition state; failure stays failed until explicitly retried or invalidated.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class DirectoryTree(style: Style = ..., highlightStyle: Style = ...) extends StatefulWidget[DirectoryTreeState]

A filesystem browser — Tree with the filesystem as its node source: lazy-loaded directory listings with expand/collapse markers, /-suffixed directory names, selection highlight, and scroll-to-selection.

A filesystem browser — Tree with the filesystem as its node source: lazy-loaded directory listings with expand/collapse markers, /-suffixed directory names, selection highlight, and scroll-to-selection.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait StatefulWidget[DirectoryTreeState]
class Object
trait Matchable
class Any
Show all
final class DirectoryTreeState(val root: Path) extends VersionedState

Caller-owned, render-thread-confined directory snapshots and interaction state.

Caller-owned, render-thread-confined directory snapshots and interaction state.

Construction, navigation and painting perform no filesystem IO. Call beginLoad on the owner thread, acquire DirectoryListing.load(request.directory) on a worker, then install on the owner thread and request a redraw. Never mutate this state from the worker. directoriesToLoad reports visible unloaded branches; loading and failed branches are excluded until explicitly retried. loadVisible is a blocking convenience for small local trees, to call explicitly outside painting, not a background pre-warm of mutable state.

Links outside root are followed; this is not a sandbox. Cycle checks use only snapshot identities along the current ancestor chain, so sibling aliases remain independently browsable. Selection, expansion and scroll are caller-owned.

Attributes

Supertypes
trait VersionedState
trait Versioned
class Object
trait Matchable
class Any
final case class Dropdown(options: Seq[String], selected: Int, maxVisibleRows: Int = ..., style: Style = ..., highlightStyle: Style = ..., borderType: BorderType = ..., closedGlyph: String = ..., openGlyph: String = ...) extends StatefulWidget[DropdownState], Measured

A collapsed option chooser: one row showing the option in force, and, while DropdownState.open, the whole option list drawn directly beneath that row as a bordered popup.

A collapsed option chooser: one row showing the option in force, and, while DropdownState.open, the whole option list drawn directly beneath that row as a bordered popup.

The popup is painted inside the widget's own Rect rather than floating over the rest of the screen, so the caller has to give it the room — see openHeight, which is what the DSL node claims while the list is open. A dropdown that is given only one row still draws its closed row correctly and simply shows no list.

The popup itself is a Menu. Drawing the list a second way here would be a second set of border, highlight, disabled and scrolling rules to keep in step with the first.

Value parameters

maxVisibleRows

how many options the popup shows at once. It is layout rather than appearance — it decides what is drawn where — which is why it sits before the styles. A longer list scrolls past it as the highlight moves.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Measured
trait StatefulWidget[DropdownState]
class Object
trait Matchable
class Any
Show all
object DropdownState

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
final class DropdownState extends Versioned

Caller-owned dropdown state: whether the option list is showing, and the highlight and scroll position of that list while it is.

Caller-owned dropdown state: whether the option list is showing, and the highlight and scroll position of that list while it is.

The highlight lives in a MenuState and is deliberately not the committed value. Moving it while the list is open changes nothing the application can see; only committing it does. That is what lets a user open the list, look around, and back out with the value they started with.

Render-thread-only. Its version is its own count of open/close changes plus menu.version, so a mutation of either half is seen (see io.worxbend.tui.core.Versioned) and a DSL node painting it schedules the frame that shows it.

Attributes

Companion
object
Supertypes
trait Versioned
class Object
trait Matchable
class Any
final case class DualSparkline(upper: Seq[Long], lower: Seq[Long], max: Option[Long] = ..., direction: SparkDirection = ..., upperStyle: Style = ..., lowerStyle: Style = ...) extends Widget

Two sparklines sharing one area (top/bottom halves) for visually comparing a pair of series — e.g. ingress vs. egress. Each series scales independently unless a shared max is given. direction is passed to both halves, so the two traces are always anchored to the same edge and remain readable against each other.

Two sparklines sharing one area (top/bottom halves) for visually comparing a pair of series — e.g. ingress vs. egress. Each series scales independently unless a shared max is given. direction is passed to both halves, so the two traces are always anchored to the same edge and remain readable against each other.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
abstract class EditBuffer(initial: String, multiline: Boolean, killRing: KillRing) extends VersionedState

The editing engine TextInputState and TextAreaState share: grapheme-cluster lines, a caret, and coalesced diff-based undo.

The editing engine TextInputState and TextAreaState share: grapheme-cluster lines, a caret, and coalesced diff-based undo.

Text is a vector of lines, each a vector of grapheme clusters, so the caret — a TextPosition — can never split a combining sequence or an emoji. GraphemeEdit stays the splice owner: every edit re-segments the lines it touches and maps the caret with right affinity, so a splice inside a newly merged grapheme lands after it.

Control characters are dropped on the way in, by the constructor as well as by insert; a multi-line buffer keeps the \n that separates lines, a single-line one drops it with the rest.

Undo stores diffs, not snapshots, and coalesces consecutive single-grapheme inserts (and consecutive deletes) into one step — see UndoLog for the grouping rule. A caret move closes the group.

Selection is an anchor plus the caret (the head): every motion takes select = true to stretch it, and typing, deleting or pasting replaces it. Word motion uses Unicode word boundaries (java.text.BreakIterator). Cut, copy and paste go through a Clipboard the caller supplies; kills go into killRing, which several buffers may share.

Render-thread-only. Every edit and caret move raises version (see io.worxbend.tui.core.Versioned), which is how the DSL notices a mutation made outside an event handler and paints it without a Signal write.

Attributes

Companion
object
Supertypes
trait VersionedState
trait Versioned
class Object
trait Matchable
class Any
Known subtypes
object EditBuffer

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
EditBuffer.type
final case class FilePatch(oldPath: Option[String], newPath: Option[String], hunks: Seq[Hunk])

The hunks of one file, with the paths its ---/+++ header named — None for /dev/null (an added or deleted file) or when there was no header at all, as for a diff computed by Patch.of.

The hunks of one file, with the paths its ---/+++ header named — None for /dev/null (an added or deleted file) or when there was no header at all, as for a diff computed by Patch.of.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Flow(items: Seq[Widget], spacing: Int = ..., rowSpacing: Int = ...) extends Widget, Measured

Lays items left to right at their natural widths and wraps onto a new line when the next one does not fit — tags, chips, a bar of buttons.

Lays items left to right at their natural widths and wraps onto a new line when the next one does not fit — tags, chips, a bar of buttons.

An item's width is its Measured.widthAt answer, which for text is its display width through CharWidth, so a CJK label takes two columns per character; its height is its heightAt at that width, or one row when it cannot say. An item that cannot say how wide it is takes a whole line of its own, and an item wider than the area starts a line of its own and is clipped at the right edge. Each line is as tall as its tallest item, spacing blank columns separate neighbours on a line and rowSpacing blank rows separate lines.

Measurement replays exactly the placement render uses, so heightAt(width) is the rows render fills at that width. Stateless and immutable; render-thread use only, like every widget.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Measured
trait Widget
class Object
trait Matchable
class Any
Show all
object Fraction

The module's unit of "how far along": a Double in [0, 1] standing for progress, sweep, intensity or a position on a ramp.

The module's unit of "how far along": a Double in [0, 1] standing for progress, sweep, intensity or a position on a ramp.

A named home for one rule that every widget taking such a value repeats. Callers pass raw ratios — a division whose denominator can be zero, a value read straight from a config file — so the rule has to say what an out-of-range or NaN value means, once, rather than once per widget with nothing keeping the copies in step.

Public because it is the documented contract of every ratio-taking widget in the module (Gauge, LineGauge, IndeterminateBar, the ramps): "clamped to [0, 1], NaN reads as no progress". A caller building its own ratio should be able to apply the same rule the widget will, and to read what that rule is.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Fraction.type
object Gauge

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Gauge.type
final case class Gauge(ratio: Double, label: ProgressLabel = ..., style: Style = ..., filledStyle: Style = ..., fillRamp: Option[ColorRamp] = ..., preset: Option[ProgressPreset] = ..., labelStyle: Option[Style] = ...) extends Widget

A filled progress bar with a centered label; the fill spans the whole area height.

A filled progress bar with a centered label; the fill spans the whole area height.

ratio is clamped to [0, 1] and NaN reads as no progress. The caption comes from a ProgressLabel, the same vocabulary LineGauge uses, and defaults to the percentage; ProgressLabel.Hidden leaves the bar uncaptioned.

fillRamp colors the fill by how far along it is. Which part of the style it colors depends on how the bar is drawn, described next.

labelStyle fixes the caption's colours in one go. Left unset, the caption over the fill is written in the fill's own two colours swapped, which is what keeps it readable; see captionStyleAt below.

There are two ways to draw the bar, and preset picks between them:

  • '''No preset (the default).''' The bar is blank cells wearing filledStyle, whose own default is Style.Default.reverse — so the bar's color is its background, and fillRamp replaces that background. The boundary is rounded to the nearest whole cell, which gives a 20-column bar 21 distinguishable states.
  • '''With a preset.''' The bar is the glyphs of a ProgressPreset, the same vocabulary LineGauge draws with, so ProgressPreset.Blocks fills whole cells with █ and paints the cell the boundary falls inside with the nearest eighth block. That turns the same 20-column bar into 161 states, and ProgressPreset.Ascii gives a #-over-- bar for a terminal with no Block Elements font. Here the glyph carries the color, so fillRamp sets the foreground rather than the background, and Reverse is dropped from filledStyle: a reversed full block paints the cell's background color over the whole cell, which is an invisible bar.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
enum GraphType

How a Dataset's points are drawn.

How a Dataset's points are drawn.

  • Line joins consecutive points with segments.
  • Scatter plots each point on its own, with nothing between them.
  • Bar drops an upright bar from each point to the dataset's fillToY baseline, which reads as a magnitude per sample rather than as a trend.
  • Area is Line with everything between the line and the baseline filled in, for a series whose size matters as much as its shape — a stack of them shows one series swamping another at a glance.

Line and Area follow the points in the order the dataset lists them — they do not sort by x, so an unsorted series draws as a zig-zag rather than a function plot.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Grid(layout: GridLayout, cells: Seq[GridEntry]) extends Widget, Measured

Renders each cell into the rectangle its placement covers in a GridLayout.

Renders each cell into the rectangle its placement covers in a GridLayout.

The geometry is the layout's; this widget adds content measurement for Constraint.Auto tracks. An Auto column is as wide as the widest cell sitting in that column alone (a cell spanning several columns does not size any one of them), measured at the height of the rows it spans. An Auto row is as tall as the tallest single-row cell at its solved column width. Both axes are refined until stable, with a sixteen-pass ceiling for mutually dependent measurements. A track no cell measures is laid out as a fill.

Cells are painted in the order given, so a later cell covering the same tracks draws over an earlier one. Stateless and immutable; render-thread use only, like every widget.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Measured
trait Widget
class Object
trait Matchable
class Any
Show all
final case class GridEntry(placement: GridPlacement, widget: Widget)

One child of a Grid: where it sits and what it draws.

One child of a Grid: where it sits and what it draws.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
enum GridPhase

How a SpinnerGrid offsets each slot's animation from its neighbours'.

How a SpinnerGrid offsets each slot's animation from its neighbours'.

The offset is what turns a block of identical spinners into one moving thing, so this is the grid's whole character. The sign rule is uniform: a slot's offset is -distance * framesPerCell, so the feature travels away from distance zero, and a negative framesPerCell reverses it.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class GroupedBar(label: String, value: Long, style: Style = ...)

One bar inside a BarGroup: what it measures, how tall it is, and the colour that identifies the series it belongs to.

One bar inside a BarGroup: what it measures, how tall it is, and the colour that identifies the series it belongs to.

style is per bar rather than per group because in a grouped chart the colour is what tells the reader which series a bar is — "this quarter's revenue" against "last quarter's" — and that repeats identically in every group. A palette such as SeriesPalette gives one style per series, and the same style is then used for that series' bar in each group. Style.Default falls back to the chart's own barStyle.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class GroupedBarChart(groups: Seq[BarGroup], barWidth: Int = ..., barGap: Int = ..., groupGap: Int = ..., max: Option[Long] = ..., barStyle: Style = ..., labelStyle: Style = ..., barSet: BarSet = ...) extends Widget

Upright bars clustered into labelled groups — the chart for comparing the same handful of series across several categories, where BarChart compares one series across them.

Upright bars clustered into labelled groups — the chart for comparing the same handful of series across several categories, where BarChart compares one series across them.

Every group is laid out identically: its bars sit barGap columns apart, and groupGap columns separate one group from the next. A group's label is written centred underneath it on the area's last row, so it has the whole group's width to fit in rather than one bar's — which is the practical reason to reach for this widget even for a single series with long category names.

The scale is shared by every bar in the chart, not computed per group. A bar's height is only readable against the bars beside it if they are all measured against the same ceiling; max sets that ceiling explicitly, and otherwise it is the largest value anywhere in the data.

A group that does not fit wholly inside the area is dropped rather than half-drawn, the same rule BarChart follows for a bar: a clipped group would show bars whose heights cannot be compared with their neighbours'.

Renders into the io.worxbend.tui.core.Buffer it is handed and nothing else, so it carries the usual widget thread constraint: call it from the render thread that owns the buffer.

Value parameters

barGap

columns between two bars of the same group

barSet

the glyphs the bars are drawn from — BarSet.Ascii for a terminal with no block elements, or a set of your own

barStyle

the style of a bar whose own style is Style.Default

barWidth

columns per bar

groupGap

columns between one group and the next, on top of barGap's own spacing

groups

the clusters, drawn left to right in the order given

labelStyle

the style of the group labels on the bottom row

max

the top of the shared scale; None means the largest value in the data

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
final case class Heatmap(values: Seq[Seq[Double]], style: Style = ...) extends Widget

A value grid rendered as shade intensity: each cell maps its value (against the grid's max) onto a shade ramp — rows are y (top first), columns are x.

A value grid rendered as shade intensity: each cell maps its value (against the grid's max) onto a shade ramp — rows are y (top first), columns are x.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
object Heatmap

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Heatmap.type
object HexViewer

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
HexViewer.type
final case class HexViewer(bytes: IndexedSeq[Byte], bytesPerRow: Int = ..., style: Style = ..., offsetStyle: Style = ..., highlightStyle: Style = ...) extends StatefulWidget[HexViewerState], Measured

A classic hex dump — 00000010 48 65 6c 6c 6f 20 57 6f 72 6c 64 0a 00 00 00 00 |Hello World.....| — over a byte sequence: the row's offset in hex, the bytes in two groups, and the printable ASCII of the same bytes (anything outside 0x20..0x7e as .), with the selected byte highlighted in both columns.

A classic hex dump — 00000010 48 65 6c 6c 6f 20 57 6f 72 6c 64 0a 00 00 00 00 |Hello World.....| — over a byte sequence: the row's offset in hex, the bytes in two groups, and the printable ASCII of the same bytes (anything outside 0x20..0x7e as .), with the selected byte highlighted in both columns.

The layout is fixed-width and pure ASCII, so it is the same at every terminal width: the viewer measures exactly one row per bytesPerRow bytes and a full row's width (Measured), and a narrower area clips each row on the right. Only the rows on screen are formatted, so a large buffer costs its viewport, not its size.

Value parameters

bytes

the data; indexed, so a row is read without walking from the start. ArraySeq.unsafeWrapArray(array) views an Array[Byte] without copying it

bytesPerRow

bytes on one row, at least 1; the hex column splits them into two halves with an extra blank between

highlightStyle

layered over the selected byte, in both columns

offsetStyle

the offset column

style

the bytes and the ASCII column

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait Measured
trait StatefulWidget[HexViewerState]
class Object
trait Matchable
class Any
Show all
final class HexViewerState extends VersionedState

Caller-owned state of a HexViewer: the selected byte and the first row on screen.

Caller-owned state of a HexViewer: the selected byte and the first row on screen.

The selection is a byte offset into the data; the scroll offset is a row index the viewer re-derives on every frame so the selection stays visible, the way a ListView's does. Render-thread-only; every mutation raises version (see io.worxbend.tui.core.Versioned), so a write made outside the event path is painted too.

Attributes

Supertypes
trait VersionedState
trait Versioned
class Object
trait Matchable
class Any

When a list reserves the gutter its highlight symbol is drawn in.

When a list reserves the gutter its highlight symbol is drawn in.

A list draws a marker — "> " by default — to the left of the selected row. The columns that marker occupies have to come from somewhere, and the three answers below differ in when they are taken away from the text.

  • Always reserves the gutter on every row whether or not anything is selected, so the text never moves sideways. This is what every list in this library did before the choice existed, and it is the default for that reason.
  • WhenSelected reserves it only while something is selected. A list nobody has selected in yet uses its full width for text, and the text shifts right by the marker's width the first time a row is highlighted. In a narrow pane those two reclaimed columns are worth the shift.
  • Never reserves nothing and draws no marker at all. Use it when the highlight style — a reversed or coloured row — is the only cue wanted, which is the usual choice for a list inside a bordered panel where every column counts.

An enum rather than two booleans, because "reserve the gutter" and "draw the marker" are not independent: reserving nothing and still drawing the marker would push the marker over the text.

These are plain values with no state, so they carry no thread constraint of their own.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Hunk(oldStart: Int, newStart: Int, lines: Seq[DiffLine], section: String = ...)

A contiguous region of change: its first line on each side (1-based) and the lines in order.

A contiguous region of change: its first line on each side (1-based) and the lines in order.

The line counts of the @@ -oldStart,oldCount +newStart,newCount @@ header are derived from lines rather than stored beside them, so a hunk cannot disagree with its own header. A side with no lines in the hunk follows the unified-diff convention: its start is the number of the line before the hunk (0 at the top of a file). section is the free text git prints after the closing @@ — usually the enclosing function — or empty.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Image

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Image.type
final case class Image(pixels: Vector[Vector[Rgb]]) extends Widget

A raster image rendered with half-block cells: every terminal cell shows two vertical pixels (▀ with the upper pixel as foreground and the lower as background), the universally supported protocol from the reference ecosystems. For a picture the terminal draws in real pixels where it can (kitty graphics, iTerm2), use PixelImage.

A raster image rendered with half-block cells: every terminal cell shows two vertical pixels (▀ with the upper pixel as foreground and the lower as background), the universally supported protocol from the reference ecosystems. For a picture the terminal draws in real pixels where it can (kitty graphics, iTerm2), use PixelImage.

pixels is row-major RGB; the image is scaled to the render area by nearest-neighbor sampling, preserving nothing but coverage — pre-scale for quality.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
enum ImageFit

How a PixelImage fits its picture into the area it is given.

How a PixelImage fits its picture into the area it is given.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object ImageIoLoader

Explicit JVM-only image decoding: JPEG, GIF, BMP, interlaced PNG and installed ImageIO formats.

Explicit JVM-only image decoding: JPEG, GIF, BMP, interlaced PNG and installed ImageIO formats.

Not re-exported by the DSL: import this object deliberately when AWT is available. Native applications should use ImageLoader instead. Missing AWT linkage returns Left; a native image still needs AWT JNI metadata and shared libraries if this adapter is reachable. Blocking I/O and decoding belong off the render thread. Malformed files, unsupported formats and images larger than 4 Mi pixels return Left; VM resource failures are not intercepted.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object ImageLoader

Native-safe PNG loading built on java.util.zip, with no dependency on java.desktop.

Native-safe PNG loading built on java.util.zip, with no dependency on java.desktop.

Encoded input is capped at 32 MiB, decoded size at 4 Mi pixels and inflated scanlines at 32 MiB. The decoder grows storage only as real compressed data arrives, never from an untrusted header alone. Malformed, unsupported and oversized inputs return readable Lefts; VM resource failures are not intercepted. Blocking I/O and decoding belong off the render thread. For JPEG, GIF, BMP or interlaced PNG on the JVM, explicitly import ImageIoLoader; its fromFile / fromBytes replace the former ImageLoader methods without dropping those formats.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
final case class IndeterminateBar(elapsed: FiniteDuration, style: Style = ..., segmentStyle: Style = ..., preset: ProgressPreset = ..., motion: IndeterminateMotion = ..., segmentWidth: Option[Int] = ..., period: FiniteDuration = ...) extends Widget

An indeterminate progress bar: a segment travelling along a track, advanced by phase.

An indeterminate progress bar: a segment travelling along a track, advanced by phase.

The glyphs come from a ProgressPreset so a determinate and an indeterminate bar in the same view can be drawn from the same vocabulary, and the travel comes from an IndeterminateMotion.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all

How an IndeterminateBar's segment travels. Indeterminate bars all say "working, no idea how long", but they say it at different volumes — pick by how much of the user's attention the task deserves.

How an IndeterminateBar's segment travels. Indeterminate bars all say "working, no idea how long", but they say it at different volumes — pick by how much of the user's attention the task deserves.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Inspect(value: PrettyValue, inlineWidth: Int = ..., style: Style = ..., labelStyle: Style = ..., guideStyle: Style = ..., highlightStyle: Style = ...) extends Widget, StatefulWidget[InspectState], Measured

A tree view of any value, for debugging: the PrettyValue description of it drawn with ├─/└─ guides, one row per node, field names and indices as labels.

A tree view of any value, for debugging: the PrettyValue description of it drawn with ├─/└─ guides, one row per node, field names and indices as labels.

A node all of whose children are atoms is kept on one row — Db(host = "localhost", pool = 4), List(1, 2, 3) — as long as that row is at most inlineWidth columns; anything else is expanded, its header (Db, List(3)) on the node's row and its children below. Atoms are always one row, however wide, and are cut at the area's edge like every other line, by display width through CharWidth.

The tree is laid out once, when the widget is built, so the inspector is Measured: one row per line and the widest line's width, at any area size.

Rendered with an InspectState the tree is collapsible: a node the state folds keeps its header row, followed by …, and hides everything under it, and the selected row's label and text are drawn in highlightStyle. Only a node drawn with children below it — not one kept on a single row — can fold (isExpandable); visiblePaths lists the rows the state leaves showing, top to bottom, for the keys that walk them. The DSL's inspect(value, state) drives this with the keyboard and the mouse.

Immutable; safe to share between frames and threads. The state is render-thread-only.

Value parameters

guideStyle

the tree guides

highlightStyle

layered over the selected row's label and text when the inspector is rendered with an InspectState

inlineWidth

the widest a node's one-row form may be before it is expanded instead; 0 expands every node that has children

labelStyle

layered over style on field names, indices and map keys

style

values and headers

value

what to draw

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait Measured
trait StatefulWidget[InspectState]
trait Widget
class Object
trait Matchable
class Any
Show all
object Inspect

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Inspect.type
final class InspectState extends VersionedState

Caller-owned state of a collapsible Inspect: which nodes are folded, and which row is selected.

Caller-owned state of a collapsible Inspect: which nodes are folded, and which row is selected.

A node is named by its path — the child indices from the root, Vector() for the root itself, Vector(3, 0) for the first child of the root's fourth — so the state stays valid while the inspected value is re-described each frame, as long as its shape does not change. A path that names nothing (the value changed shape) is simply never drawn. Nothing starts collapsed, and with no selection the root row counts as selected.

Render-thread-only. Every mutation raises version (see io.worxbend.tui.core.Versioned), so a write made outside the event path is painted too, with no Signal write.

Attributes

Supertypes
trait VersionedState
trait Versioned
class Object
trait Matchable
class Any
final case class KeyedRow[K](key: K, cells: Seq[String])

One DataTable row: a stable identity plus the text cells the table sorts, filters and draws.

One DataTable row: a stable identity plus the text cells the table sorts, filters and draws.

The key is what lets a selection survive everything the widget does to the row order: DataTable.render records the selected row's key on every frame and re-anchors the highlight to the same key after a re-sort or a data refresh, so a table of processes keeps its highlight on the same PID instead of on whatever row number it happened to occupy. Keys are compared with ==; give each row a key that is unique within the table — when two rows share one, the first in view order is the one the selection anchors to.

cells is a projection of the record into display text: the table sorts and filters on these strings exactly as it always has, and the record itself never has to be parsed back out of its own formatting.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final class KillRing(capacity: Int = ...)

The Emacs/readline kill ring: text removed by kill commands (Ctrl+K, Ctrl+U, Ctrl+W, Alt+D), newest first, for Ctrl+Y to yank back and Alt+Y to cycle through.

The Emacs/readline kill ring: text removed by kill commands (Ctrl+K, Ctrl+U, Ctrl+W, Alt+D), newest first, for Ctrl+Y to yank back and Alt+Y to cycle through.

Separate from the Clipboard on purpose — killing a line does not overwrite what the user copied. Consecutive kills accumulate into one entry, the way readline's do, so Ctrl+K Ctrl+K yanks back as one piece. Holds at most capacity entries, dropping the oldest. One ring may be shared between several editors so a kill in one field yanks in another; pass the same instance to each state.

Render-thread-only, like the editor states that write it.

Attributes

Supertypes
class Object
trait Matchable
class Any
object Language

The four lexers Language used to enumerate, plus the info-string resolver.

The four lexers Language used to enumerate, plus the info-string resolver.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Language.type
object LayoutItem

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
LayoutItem.type
final case class LayoutItem(constraint: Constraint, widget: Widget, align: Option[CrossAlign] = ...)

One slot of a Row or Column: how much space the slot claims, what renders inside it, and — when set — where it sits across the container's axis, overriding the container's own CrossAlign.

One slot of a Row or Column: how much space the slot claims, what renders inside it, and — when set — where it sits across the container's axis, overriding the container's own CrossAlign.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object LazyListState

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
final class LazyListState extends VersionedState

The caller-owned state of a LazyListView: which item is selected and which item is scrolled to the top.

The caller-owned state of a LazyListView: which item is selected and which item is scrolled to the top.

Both count items, not rows, the same way ListState does. The widget re-derives offset on every render to clamp it to the last page and to keep the selection on screen, so setting a selection is enough to scroll to it.

Besides the two fields the caller writes, the state remembers what the last render saw — how many items the viewport held and which item was on top — because whoever builds the items (the DSL's lazyList) has to decide which ones to build before layout has run, and the last frame's viewport is the best answer available then. See buildWindow.

'''Ownership and threads.''' Created and owned by the caller, mutated on the render thread only. Every public mutator raises version, so a host watching the state redraws after a write made outside the event path; what a render records about itself does not, since it is not a change to what the state holds.

Attributes

Companion
object
Supertypes
trait VersionedState
trait Versioned
class Object
trait Matchable
class Any
final case class LazyListView(count: Int, itemHeight: Int, item: Int => Option[Widget], highlightStyle: Style = ...) extends StatefulWidget[LazyListState], Measured

A virtual list of count items, each itemHeight rows tall, that asks for — and draws — only the items on screen.

A virtual list of count items, each itemHeight rows tall, that asks for — and draws — only the items on screen.

item(i) is called once per visible item per render and nowhere else, so a list of a million items costs what a screenful costs. It answers None for an item that is not available yet; the row is left blank and the state records the miss (LazyListState), which is how the DSL's lazyList learns that the items it built for this frame fell short of the viewport and builds again.

Two ways of scrolling, decided by the area alone. Handed fewer rows than count * itemHeight — the usual case — the list scrolls itself, by whole items, from the state's offset. Handed room for everything — the content of a scroll view, which lays content out at full height and clips it with a window-sized buffer — it does not scroll at all and draws only the items inside the buffer's bounds.

The selected item has highlightStyle patched over the rows it occupies after it is drawn. An item that does not fit whole at the bottom is drawn into the rows that remain.

Named LazyListView rather than LazyList so it never shadows scala.LazyList in this package or under the DSL's one import — the reason ListView is not List.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Measured
trait StatefulWidget[LazyListState]
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
final case class LegendConstraints(horizontal: Constraint, vertical: Constraint)

The two limits a Chart legend must satisfy before it is drawn: how much of the plot's width horizontal and height vertical it may claim. A named pair, because (Constraint, Constraint) says nothing about which limit is which — the same tuple shape serves this module for other paired values — and a function handed the wrong one compiles fine. Mirrors Bounds, the same idea over the chart's world range.

The two limits a Chart legend must satisfy before it is drawn: how much of the plot's width horizontal and height vertical it may claim. A named pair, because (Constraint, Constraint) says nothing about which limit is which — the same tuple shape serves this module for other paired values — and a function handed the wrong one compiles fine. Mirrors Bounds, the same idea over the chart's world range.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class LexState(open: String = ..., indent: Int = ..., depth: Int = ...)

Where a Lexer stands at the end of a line: inside nothing (LexState.Initial) or inside a construct that continues onto the next line. An immutable value the lexer that produced it reads back; nothing else interprets it.

Where a Lexer stands at the end of a line: inside nothing (LexState.Initial) or inside a construct that continues onto the next line. An immutable value the lexer that produced it reads back; nothing else interprets it.

Value parameters

depth

a nesting depth — how many YAML flow collections are open

indent

an indentation the construct depends on — the column a YAML block scalar's key sits at

open

what the line ended inside, in the lexer's own words — the built-in lexers use the delimiter that closes it (the end of a block comment, a triple quote, a quote) or a mode name (yaml-block, yaml-flow); empty for nothing

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object LexState

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
LexState.type
final case class LexedLine(line: Line, next: LexState)

The highlighted line and the state passed to the following line by a Lexer. Immutable and safe to share; the line's spans must concatenate to the original source exactly.

The highlighted line and the state passed to the following line by a Lexer. Immutable and safe to share; the line's spans must concatenate to the original source exactly.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Lexer

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Lexer.type
trait Lexer

Turns one line of source into styled io.worxbend.tui.core.Spans — the open extension point behind SyntaxHighlighter, a Markdown fence and TextAreaOptions.lexer.

Turns one line of source into styled io.worxbend.tui.core.Spans — the open extension point behind SyntaxHighlighter, a Markdown fence and TextAreaOptions.lexer.

Highlighting is line-oriented, with a LexState carried from the end of one line to the start of the next: the three-argument highlightLine takes the state the previous line ended in and answers the state this one ends in, so a block comment, a triple-quoted string or a YAML block scalar that spans lines is highlighted on every line it covers. highlight threads it through a whole text, and so do a Markdown fence and a TextArea. The two-argument form lexes one line on its own, from LexState.Initial; a lexer that keeps no state implements only that one, and the stateful form defaults to it. The spans of the returned Line must concatenate back to line exactly — an editor maps them onto its grapheme clusters, and a lexer that drops or adds characters has its styling ignored there.

Implementations are immutable values and safe to share between threads; aliases are the lower-case info-string names ( ```yaml) a Markdown fence resolves through Lexer.among.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
final case class LineGauge(ratio: Double, label: ProgressLabel = ..., style: Style = ..., filledStyle: Style = ..., preset: ProgressPreset = ..., fillRamp: Option[ColorRamp] = ...) extends Widget

A one-row progress meter: a caption followed by a filled/unfilled line.

A one-row progress meter: a caption followed by a filled/unfilled line.

The glyphs come from a ProgressPreset, so a bar can step whole cells or move smoothly with sub-cell partials without this widget knowing which. ratio is clamped to [0, 1] and NaN reads as no progress.

fillRamp colors the fill by how far along it is. It overrides filledStyle's foreground and nothing else, so the modifiers set there still apply.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
object LineGauge

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
LineGauge.type
enum LinearAxis

Which way a linear spinner's track runs, and therefore which sub-cell axis carries its position.

Which way a linear spinner's track runs, and therefore which sub-cell axis carries its position.

The two are not symmetric, and the asymmetry is worth knowing before choosing one. A braille cell is 2 dots across and 4 down, so a horizontal track buys 2 positions per cell and can grade each over 4 brightness levels, while a vertical track buys 4 positions per cell and can grade each over 2. Horizontal moves in coarser steps and fades more smoothly; vertical is the other way round.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
enum LinearFlow

Which way a linear spinner travels. An enum rather than a signed rate or a reversed: Boolean, so a call site reads as a direction and a reversed spinner is greppable rather than a minus sign away from a typo.

Which way a linear spinner travels. An enum rather than a signed rate or a reversed: Boolean, so a call site reads as a direction and a reversed spinner is greppable rather than a minus sign away from a typo.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
enum LinearPath

The walk a linear spinner's head takes along a one-dimensional track.

The walk a linear spinner's head takes along a one-dimensional track.

A path rather than two widgets: the animation is one head with a trail behind it, and only the walk differs. Each case owns its own cycle length and its own reading of LinearFlow, because the two are not reversed by the same operation — see positionAt.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class LinearSpinner(elapsed: FiniteDuration, options: LinearSpinnerOptions = ...) extends Widget

A head travelling a one-cell-thick track at sub-cell resolution, drawn from how long the animation has been running.

A head travelling a one-cell-thick track at sub-cell resolution, drawn from how long the animation has been running.

The row-or-column-shaped member of the animation family: where Spinner says "working" inside one glyph and OrbitSpinner says it in a block, this says it along a line — a status row under a log pane, or a column beside one. Like every animation here the frame is a pure function of elapsed, so a test renders any moment directly and an app with no tickRate still shows a legible first frame.

The three motion knobs in options are deliberately orthogonal, which is the difference from the obvious design: LinearPath is the walk, LinearTrail is the shading, trailSlots is the length. A bouncing head with a comet tail and a wrapping window of solid slots are the same widget with different arguments, rather than two modes in which half the options are silently ignored. See LinearSpinnerOptions for every knob, the rail included.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
final case class LinearSpinnerOptions(axis: LinearAxis = ..., path: LinearPath = ..., flow: LinearFlow = ..., trail: LinearTrail = ..., trailSlots: Int = ..., rail: Double = ..., resolution: CanvasResolution = ..., period: FiniteDuration = ..., style: Style = ..., headStyle: Style = ..., marker: String = ...)

Everything about a LinearSpinner that is not the time: the track, the walk, the shading, and how both are drawn.

Everything about a LinearSpinner that is not the time: the track, the walk, the shading, and how both are drawn.

Bundled rather than listed on LinearSpinner itself because the list had grown to eleven optional knobs. Every field keeps the default it had as a LinearSpinner constructor parameter, so LinearSpinnerOptions() is exactly the track the bare constructor drew. The vocabulary mirrors OrbitSpinnerOptions.

Value parameters

axis

whether the track runs along a row or down a column

flow

which way the head travels

headStyle

the style of the head and the part of the trail brighter than the rail

marker

read at CanvasResolution.Cell only — the glyph each hit cell is drawn with there

path

the walk — wrapping round at the end or bouncing back

period

how long one cycle takes — a traverse when wrapping, a round trip when bouncing

rail

the resting brightness of the whole track on the same 0..1 scale as the trail. It is what turns an empty row into a visible track, and the rule at the meeting point is chosen rather than accidental: a slot is drawn in headStyle only where it is brighter than the rail, so a comet's tail dissolves into the track instead of ending on a hard edge. 0.0 leaves the track empty and the head appears to float

resolution

the sub-cell resolution the track is drawn at; CanvasResolution.Cell with an ASCII marker is the floor

style

the style of the resting track

trail

how the slots behind the head are shaded

trailSlots

the length of the trail in sub-cell slots, not cells, because that is the resolution the motion happens at — at braille a horizontal track has two slots per cell, so the default four slots is two cells of tail

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

How the slots behind a linear spinner's head are shaded.

How the slots behind a linear spinner's head are shaded.

Every case is a function of one number — how many steps ago the head was in that slot — because that is what makes a trail work on a bouncing path as well as a wrapping one. A trail defined by position behind the head has no answer at the turn, where "behind" flips; a trail defined by time simply folds back over itself, and the brighter sample wins.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Link(label: String, url: String, style: Style = ...) extends Widget

A clickable hyperlink (OSC 8): renders label underlined with the link attached — terminals without OSC 8 support just show the styled text.

A clickable hyperlink (OSC 8): renders label underlined with the link attached — terminals without OSC 8 support just show the styled text.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all

Which edge of its area a list is anchored to, and which way its rows run from there.

Which edge of its area a list is anchored to, and which way its rows run from there.

TopToBottom is the ordinary reading order: the first visible item is drawn on the top row of the area and the rest follow downward, so a list shorter than its area leaves the space underneath it empty.

BottomToTop anchors to the opposite edge: the first visible item is drawn on the last row of the area and the rest climb upward, so a short list sits against the floor of its area and the empty space ends up above it. That is the shape a chat transcript or a log tail wants — the entry the reader cares about most stays welded to the bottom edge instead of floating in the middle of a half-empty pane. Because the first item of the sequence lands on the bottom row, a caller using this direction feeds its items newest-first.

This is an enum rather than a reversed: Boolean parameter for the reason the style guide gives for preferring a sealed type over a flag: at the call site ListDirection.BottomToTop says what it does where true would not, and a third anchoring rule could be added later without changing the parameter's type.

These are plain values with no state, so they carry no thread constraint of their own.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object ListState

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
ListState.type
final class ListState extends VersionedState

Caller-owned list state: the selection, the scroll offset and how close to the edge the selection is allowed to get. Mutable on purpose — the widget adjusts the offset during render to keep the selection visible, and the app mutates the selection from key handlers (the StatefulWidget contract).

Caller-owned list state: the selection, the scroll offset and how close to the edge the selection is allowed to get. Mutable on purpose — the widget adjusts the offset during render to keep the selection visible, and the app mutates the selection from key handlers (the StatefulWidget contract).

scrollPadding is the number of further items kept visible on each side of the selection whenever the list is long enough to show them. It defaults to 0, which is the behaviour every 0.12.0 list already had: the highlight can come to rest on the top or bottom visible row, with more items just out of sight. Set it to 2 and the list starts scrolling under the highlight two rows before the highlight would reach the edge. See ScrollWindow.offsetFor for the exact rule, including how it degrades at the two ends of the list.

The state also remembers how the last item sequence it rendered lays out in rows — whether every item is one row high, and each item's height when not — keyed by the sequence's identity, the way TreeState and DataTableState remember their flattened rows and filtered views. That is what lets a frame over an unchanged items reference cost the viewport rather than the list: the widget value is rebuilt every frame by the DSL, so the state is the only thing that outlives a frame. Retain the sequence between frames to reuse the measurement; replace it to refresh. A sequence whose contents change under the same reference is still drawn correctly — the widget re-measures when the item count moves or when a drawn item's height disagrees with what it remembered — but a height change on an item that is off screen is not seen until it scrolls into view.

Render-thread-only. Every mutation raises version (see io.worxbend.tui.core.Versioned), so a DSL node that paints this state notices a write made outside the event path — a background result applied on the render thread — and schedules the frame that shows it, with no Signal write and no requestRedraw().

Attributes

Companion
object
Supertypes
trait VersionedState
trait Versioned
class Object
trait Matchable
class Any
final case class ListView(items: Seq[String | Line | Text], direction: ListDirection = ..., highlightSpacing: HighlightSpacing = ..., repeatHighlightSymbol: Boolean = ..., style: Style = ..., highlightStyle: Style = ..., highlightSymbol: String = ..., itemPrefix: Int => String = ...) extends StatefulWidget[ListState], Measured

A scrollable list of single-row items with an optional highlighted selection.

A scrollable list of single-row items with an optional highlighted selection.

Named ListView rather than the reference libraries' List to avoid colliding with scala.List at every call site.

An item is a plain String, a multi-style Line, or a whole Text, and the three may be mixed in one list. The union type saves every caller with plain text the items.map(Line.raw) ceremony without closing the door on a styled row; it follows the shape Layout.apply already uses for its Int | Double | Constraint constraints. Normalising a plain String into a Line happens per drawn row, in linesOf, and only for the rows the viewport actually shows: the DSL builds a fresh ListView value every frame, so converting the whole items sequence up front would put the cost of the entire list — 50 000 items is 3 MiB of Lines — on every repaint to draw at most a screenful.

itemPrefix supplies an optional per-item marker, evaluated only for painted rows. It does not change row heights or the source identity used by the layout cache: rebuilding a multi-select list must not project every item merely to add a check mark. Prefixes repeat on each visible line of a multi-row item and clip inside the list's area.

A Text item occupies one row per line it holds, which is how a row says a title on one line and a dimmed subtitle under it. Selection, the keyboard moves and the scroll offset all still count items, not rows, so one press of Down moves past the whole block; the offset arithmetic that keeps the selection on screen is ScrollWindow.offsetForItems. A Text with no lines at all still takes one blank row, so an item can never become invisible and therefore unreachable. The last item on screen may be cut off part way through, which is what lets a block taller than the whole viewport still show its top — or, in a bottom-to-top list, its bottom: the cut always falls on the lines past the far edge, so a block keeps its reading order whichever edge the list grows from, and a BottomToTop item too tall for the rows left above its predecessors loses its top lines.

repeatHighlightSymbol decides whether the marker is drawn on every row of a selected multi-row item or only on its first. The default draws it once, so the marker reads as pointing at the item; repeating it reads as marking each row, which suits an item whose rows are a list of their own.

direction picks which edge of the area the rows are anchored to; see ListDirection. It changes only where the visible rows are painted — the selection clamping and the scroll offset are index arithmetic and are identical in both directions. Items are placed as blocks, so BottomToTop stacks the items upwards from the floor while the lines inside each item still read top-down: a title stays above its subtitle, and the highlight marker sits on the item's first visible line — its top row, or the topmost row left when a bottom-to-top block is cut at the ceiling.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Measured
trait StatefulWidget[ListState]
class Object
trait Matchable
class Any
Show all
final case class Log(style: Style = ..., matchStyle: Style = ..., currentMatchStyle: Style = ...) extends StatefulWidget[LogState]

An append-only scrolling text panel (build/log output, chat transcripts).

An append-only scrolling text panel (build/log output, chat transcripts).

Each line is drawn at its own Line.alignment — a centred banner stays centred — and left-aligned when it names none.

Rendered with a SearchState (the four-argument render), the log searches every line it holds — not only the ones on screen — highlights the matches in matchStyle, the current one in currentMatchStyle, where the line is drawn, and scrolls so the current match's line is visible whenever the query changes or the search steps with next/previous.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait StatefulWidget[LogState]
class Object
trait Matchable
class Any
Show all
final class LogState(maxLines: Int = ...) extends VersionedState

Caller-owned Log state: a bounded ring of lines plus follow-tail scrolling.

Caller-owned Log state: a bounded ring of lines plus follow-tail scrolling.

While follow is on (the default), the view pins to the newest lines; scrolling up detaches it and scrolling back to the bottom re-attaches.

Render-thread-only. Every mutation raises version (see io.worxbend.tui.core.Versioned), so a DSL node that paints this state notices a write made outside the event path — a background result applied on the render thread — and schedules the frame that shows it, with no Signal write and no requestRedraw().

Attributes

Supertypes
trait VersionedState
trait Versioned
class Object
trait Matchable
class Any

How much coastline detail Shape.WorldMap paints.

How much coastline detail Shape.WorldMap paints.

The two outlines are the same coastlines sampled at different densities, so a map does not change shape between them, only how closely it follows the real thing. Which one to pick is a question of how many dots the canvas has, not of how the map should look: painting five thousand points into a pane that offers a few hundred dots costs four times the work to draw the same picture.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Markdown(source: String, theme: MarkdownTheme = ..., options: MarkdownOptions = ...) extends Widget, Measured

Renders a pragmatic Markdown subset: #/##/###+ headings, -/*/+ bullets and 1. numbered items nested by indentation, - [ ]/- [x] task items, GFM tables, > blockquotes, fenced code blocks, and inline **strong** / *emphasis* / `code`.

Renders a pragmatic Markdown subset: #/##/###+ headings, -/*/+ bullets and 1. numbered items nested by indentation, - [ ]/- [x] task items, GFM tables, > blockquotes, fenced code blocks, and inline **strong** / *emphasis* / `code`.

Inline [label](url) links render underlined with an OSC 8 target. Deliberately excluded: images and raw HTML — this is a document viewer for help screens, READMEs and LLM output, not a rendering-complete engine. Prose always wraps at the area width (cluster-safe) — there is no clipping mode, because a document that silently lost the right-hand half of its sentences would not be a document viewer. A table is laid out to the area width: columns are measured through CharWidth (so CJK and emoji cells align), the widest shrink first when the table does not fit, and a cell wider than its column wraps or truncates per MarkdownOptions.tableOverflow. Code blocks render verbatim, except that a fence whose info string names a lexer in MarkdownOptions.lexers (```yaml) is coloured through it.

For text that is still arriving — an LLM's reply, token by token — render a MarkdownStream instead, which closes the syntax a half-written document leaves open.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Measured
trait Widget
class Object
trait Matchable
class Any
Show all
final case class MarkdownOptions(tableOverflow: TableOverflow = ..., lexers: Seq[Lexer] = ..., listIndent: Int = ..., bullets: Seq[String] = ..., taskDone: String = ..., taskOpen: String = ...)

Behaviour and glyph knobs for Markdown; MarkdownOptions() is exactly the document the bare constructor draws.

Behaviour and glyph knobs for Markdown; MarkdownOptions() is exactly the document the bare constructor draws.

Value parameters

bullets

the unordered-list marker per nesting level, cycling when a list nests deeper than the sequence is long

lexers

the lexers a fenced code block's info string is resolved against, first match wins; a fence no lexer claims renders verbatim in the code style. Append your own Lexer to Lexer.builtIn to teach fences a language.

listIndent

columns of indentation per nesting level of a list

tableOverflow

what a too-wide table cell does — see TableOverflow

taskDone

the glyph a checked task item (- [x]) draws in place of its bullet

taskOpen

the glyph an unchecked task item (- [ ]) draws in place of its bullet

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Closes the syntax a half-written Markdown document leaves open, so text that is still arriving — an LLM's reply, token by token — renders the way it will once it is complete instead of flashing literal markers.

Closes the syntax a half-written Markdown document leaves open, so text that is still arriving — an LLM's reply, token by token — renders the way it will once it is complete instead of flashing literal markers.

Only what is still being written is touched: an open code fence is closed, and on the last line an unclosed **strong, *emphasis or `code gets its closer, a half-written [label](ur shows just its label, a [lab still being typed drops its bracket, and a bare #/## with no heading text yet is held back. Earlier lines are complete by definition and pass through untouched, as does well-formed text — sanitize(doc) == doc for every document whose last line closes what it opens, which is why a finished stream renders exactly like the document. A marker followed by a blank (2 * 3) is not an opener, so arithmetic is never "closed". Pure and thread-safe.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
final class MarkdownStream(initial: String = ...) extends Versioned

Caller-owned Markdown that is still arriving — an LLM's reply, a log being narrated — rendered stably while it grows.

Caller-owned Markdown that is still arriving — an LLM's reply, a log being narrated — rendered stably while it grows.

append chunks as they come; markdown is the Markdown widget to draw, built over MarkdownSanitizer.sanitize(text) so a half-written **bold, link or code fence renders as it will once complete rather than flashing literal markers. Once the source is done, finish stops sanitizing, and the frame is then exactly Markdown(text)'s. Appending to a finished stream reopens it.

Render-thread-only. version (the same counter as revision) moves on every append, finish and clear, so a markdownStream node notices a chunk appended outside the event path and schedules the frame that shows it. Hop to the render thread (RenderThread.capture() before going async) to append; no Signal write is needed.

Attributes

Supertypes
trait Versioned
class Object
trait Matchable
class Any
final case class MarkdownTheme(heading1: Style = ..., heading2: Style = ..., heading3: Style = ..., strong: Style = ..., emphasis: Style = ..., code: Style = ..., quote: Style = ..., bullet: Style = ..., link: Style = ..., syntax: SyntaxTheme = ..., tableHeader: Style = ..., tableBorder: Style = ..., taskDone: Style = ...)

Styles for each Markdown construct; override individual entries to theme the view.

Styles for each Markdown construct; override individual entries to theme the view.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Marker

The one-column glyphs a sub-cell surface draws a single dot with at CanvasResolution.Cell.

The one-column glyphs a sub-cell surface draws a single dot with at CanvasResolution.Cell.

Canvas, Chart, OrbitSpinner and LinearSpinner all take a marker, and each of them wrote its own default down as a bare string literal. Two things went wrong with that. An application choosing its own marker had no way to name the default it was replacing — the library's own bullet was a private value it could not reach — and the same glyph appearing in four unrelated files is four places to keep in step.

These are plain Strings rather than an enum on purpose: a marker may be any glyph exactly one column wide, and the surfaces accept whatever the application picks (anything wider is refused and drawn as Dot instead, so a two-column emoji cannot smear into the cell next door). Naming them is about being able to say which one you mean, not about restricting the choice.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Marker.type
final case class Marquee(content: String, elapsed: FiniteDuration, style: Style = ..., gap: Int = ..., cellsPerSecond: Double = ...) extends Widget

Text scrolling horizontally through the area (news-ticker style); the text wraps around with a gap between repetitions.

Text scrolling horizontally through the area (news-ticker style); the text wraps around with a gap between repetitions.

cellsPerSecond is a reading speed rather than a step count, so the same marquee scrolls at the same rate whatever the app's tick rate. Around 8 cells per second is comfortable to read.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
final case class Menu(items: Seq[MenuEntry], style: Style = ..., highlightStyle: Style = ..., disabledStyle: Style = ..., borderType: BorderType = ...) extends StatefulWidget[MenuState], Measured

A vertical menu / dropdown / context menu rendered as a bordered popup.

A vertical menu / dropdown / context menu rendered as a bordered popup.

Labels sit on the left, shortcut hints right-aligned; the highlighted row draws with highlightStyle, disabled rows dim, separators become a full-width rule. Backend-agnostic and render-to-Buffer tested; the DSL wrapper adds focus, key, and mouse handling.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Measured
trait StatefulWidget[MenuState]
class Object
trait Matchable
class Any
Show all
object MenuBar

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
MenuBar.type
final case class MenuBar(menus: Seq[MenuBarMenu], style: Style = ..., activeStyle: Style = ..., mnemonicStyle: Style = ..., highlightStyle: Style = ...) extends StatefulWidget[MenuBarState], Measured

A one-row menu bar: each title padded by a space either side, File Edit View, its mnemonic letter in mnemonicStyle and the open menu's title in activeStyle. The drop-down itself is a Menu over the open menu's entries; dropdown builds it with this bar's styles, and titleSpan says where it hangs from.

A one-row menu bar: each title padded by a space either side, File Edit View, its mnemonic letter in mnemonicStyle and the open menu's title in activeStyle. The drop-down itself is a Menu over the open menu's entries; dropdown builds it with this bar's styles, and titleSpan says where it hangs from.

Stateless apart from the caller-owned MenuBarState; render-thread use only.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait Measured
trait StatefulWidget[MenuBarState]
class Object
trait Matchable
class Any
Show all
final case class MenuBarMenu(title: String, items: Seq[MenuEntry], mnemonic: Option[Char] = ...)

One drop-down of a MenuBar: its title on the bar, its entries, and the letter that opens it with Alt. The letter defaults to the title's first character; key is it lower-cased, which is how it is matched.

One drop-down of a MenuBar: its title on the bar, its entries, and the letter that opens it with Alt. The letter defaults to the title's first character; key is it lower-cased, which is how it is matched.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object MenuBarState

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
final class MenuBarState extends Versioned

Caller-owned MenuBar state: which menu is dropped down, if any, and the highlight inside it (a MenuState).

Caller-owned MenuBar state: which menu is dropped down, if any, and the highlight inside it (a MenuState).

Render-thread-only and Versioned: version is its own mutation count plus the menu state's.

Attributes

Companion
object
Supertypes
trait Versioned
class Object
trait Matchable
class Any
enum MenuEntry

One entry in a Menu: either a row the user can land on, or a rule that divides two groups of them.

One entry in a Menu: either a row the user can land on, or a rule that divides two groups of them.

A sum type rather than one case class with a separator: Boolean, because that flag made a labelled, shortcut- carrying, enabled separator representable — four fields describing something with no label, no shortcut and no enabled state. Here a Separator has nothing to configure, which is exactly what it is.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final class MenuState extends VersionedState

Caller-owned menu state: the highlighted entry and the scroll offset for menus taller than their popup. Mutable on purpose (the StatefulWidget contract); navigation helpers skip separators and disabled entries.

Caller-owned menu state: the highlighted entry and the scroll offset for menus taller than their popup. Mutable on purpose (the StatefulWidget contract); navigation helpers skip separators and disabled entries.

selected is None when nothing is highlighted, which is the honest state of a menu whose entries are all separators or all disabled — Menu.render normalizes to it, and the widget then paints no highlight at all. Owned by whoever constructs it and read by the render thread, like every other widget state in this module.

Render-thread-only. Every mutation raises version (see io.worxbend.tui.core.Versioned), so a DSL node that paints this state notices a write made outside the event path — a background result applied on the render thread — and schedules the frame that shows it, with no Signal write and no requestRedraw().

Attributes

Companion
object
Supertypes
trait VersionedState
trait Versioned
class Object
trait Matchable
class Any
object MenuState

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
MenuState.type

What a border cell does when it lands on a cell that already holds a box-drawing glyph.

What a border cell does when it lands on a cell that already holds a box-drawing glyph.

Two panels laid side by side share a column: the left panel draws its right wall there, and the right panel then draws its left wall over the top. With Replace the second write simply wins and the result is one wall — but the corners do not join, so the seam reads as ┐┌ stacked over ┘└ rather than as ┬ over ┴.

The other two strategies decode the glyph already in the buffer and the one being written into their four arms (the line weight running right, up, left and down out of the cell), combine the arms, and look the combined shape back up:

  • Exact writes the combined glyph when Unicode has one, and otherwise leaves the incoming glyph in place;
  • Fuzzy does the same, but when no combined glyph exists it retries with every double-line arm weakened to a single line, because Unicode has no glyph for a double line meeting a heavy one. A double-walled panel touching a thick-walled one then still joins, at the cost of drawing the joint one weight lighter.

Replace is the default everywhere, so a frame drawn without asking for merging is unchanged.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class MultiProgress(tasks: Seq[ProgressTask], columns: Seq[ProgressColumn] = ..., options: MultiProgressOptions = ...) extends Widget, Measured

Rich/Spectre-style multi-task progress: one row per ProgressTask, each row the same ProgressColumns.

Rich/Spectre-style multi-task progress: one row per ProgressTask, each row the same ProgressColumns.

Text columns are as wide as the widest value any row produces (so they line up down the table), measured with CharWidth; the flexible bars share whatever the text columns and gaps leave. A bar's filled length is the task's fraction of the bar's cells rounded down, so a bar is never full before the work is. Rows past the area's height are not drawn; columns past its width are clipped.

Stateless: the tasks are caller-owned, and the widget only reads them.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Measured
trait Widget
class Object
trait Matchable
class Any
Show all
final case class MultiProgressOptions(gap: Int = ..., style: Style = ..., descriptionStyle: Option[Style] = ..., fillStyle: Style = ..., trackStyle: Style = ..., fillSymbol: String = ..., trackSymbol: String = ...)

The appearance of a MultiProgress: every field keeps the default the bare widget draws with.

The appearance of a MultiProgress: every field keeps the default the bare widget draws with.

Value parameters

descriptionStyle

the label column's style, style when unset

fillStyle

the bar's completed part

fillSymbol

the glyph the completed part repeats

gap

blank columns between two columns of a row

style

the base style of every text column

trackStyle

the bar's remaining part

trackSymbol

the glyph the remaining part repeats

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Notice(message: String, level: NoticeLevel = ..., timestamp: Option[LocalTime] = ..., style: Style = ..., accentStyle: Style = ..., timestampStyle: Style = ..., icon: Option[String] = ..., overflow: Overflow = ...) extends Widget, Measured

One styled message line: an icon, an optional timestamp, and the message.

One styled message line: an icon, an optional timestamp, and the message.

[12:04:31] ✔ deployed 8 services

The timestamp is passed in rather than read from the clock, because a widget that called LocalTime.now() would render differently on every frame — the frame would stop being a pure function of its inputs, golden-frame tests would be impossible, and a redraw triggered by something else entirely would silently change the displayed time. Stamp the message when the event happens, which is the moment the reader actually cares about.

A message longer than the area is clipped, not wrapped. Pass overflow = Overflow.Wrap for a notice that should grow onto further rows instead, and ask heightAt how many rows that turns out to be.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait Measured
trait Widget
class Object
trait Matchable
class Any
Show all
object Notice

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Notice.type

The severity of a message to the user, shared by every surface that reports one — notices, toasts, and badges.

The severity of a message to the user, shared by every surface that reports one — notices, toasts, and badges.

One enum rather than one per widget, because severity is the same idea everywhere and a second copy would drift: an app that maps its own error type onto a level should not have to map it again per widget.

The glyphs are deliberately from the geometric-shapes and dingbat blocks rather than emoji: emoji are two columns wide and inconsistently rendered, which makes a column of notices ragged.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
enum OrbitPath

The closed loop an OrbitSpinner's arc travels.

The closed loop an OrbitSpinner's arc travels.

A path rather than two widgets because the animation is identical — a bright window sliding along a loop — and only the loop differs. Both are rasterised by RingWalk into an ordered dot sequence, so sweep is a fraction of the lap on either of them and thickness falls out as the same lap at a smaller extent.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object OrbitSpinner

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
final case class OrbitSpinner(elapsed: FiniteDuration, options: OrbitSpinnerOptions = ...) extends Widget

A figure drawn at sub-cell resolution with a bright arc chasing round it, from how long the animation has been running.

A figure drawn at sub-cell resolution with a bright arc chasing round it, from how long the animation has been running.

The block-shaped counterpart to Spinner: where a one-cell spinner has to say "working" inside a single glyph, this has an area to say it in, so it is what a full-screen "connecting…" pane wants and what a status line does not. Like every animation here the frame is a pure function of elapsed — no state between renders, no clock read inside render, so a test renders any moment directly and an app with no tickRate shows a legible first frame.

options.radius is in DOTS, not cells, because that is the resolution the shape is drawn at — a radius in cells could not express the difference between the two smallest legible rings. Left unset the figure fills its area, staying round: an extreme aspect ratio yields a small centred ring rather than a squashed one, because a squashed circle reads as a wobble rather than as a rotation.

options.sweep is the fraction of the lap that is lit, not a dot count. A dot count makes the arc's apparent angle change with radius, which keeps radius and arc length from being independent knobs.

options.resolution and options.marker are the pair Canvas already ships, and reusing them is what gives this widget an ASCII floor: CanvasResolution.Cell with marker = "*" draws the same figure at a quarter of the vertical resolution on a terminal with no braille block. options.marker is read at that resolution only.

ONE STYLE PER CELL — the constraint this widget is shaped around. A braille cell packs eight dots and carries one Style, so dot resolution is 2x4 per cell while colour resolution is 1 per cell. Two rules follow, both chosen rather than fallen into. Masks are OR-ed, so a cell holding both arc and path dots keeps every dot and the resting path never erodes. Styles take the brightest dot in the cell, so such a cell reads as arc: the head is never overwritten by its own tail, and the quantisation error runs in one predictable direction — a cell can read brighter than it should, never dimmer, so the arc never appears to break. The budget, measured rather than estimated: the default radius-4 braille ring is 24 dots but only 11 cells, so a ramped comet shows 11 shades, not 24 (5 at the default sweep), and thickness buys geometry rather than colour. The alternative — one dot per cell, so colour and geometry agree — throws away the resolution braille was chosen for, and is rejected.

The consequence worth knowing before reaching for this on a monochrome terminal: because the mask never erodes, the glyphs are a pure function of the geometry and the whole animation lives in the per-cell style. A golden frame must therefore assert styles, not glyphs, and a terminal rendering neither colour nor dim shows a static ring.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
final case class OrbitSpinnerOptions(style: Style = ..., arcStyle: Style = ..., path: OrbitPath = ..., trail: OrbitTrail = ..., sweep: Double = ..., radius: Option[Int] = ..., thickness: Int = ..., resolution: CanvasResolution = ..., marker: String = ..., direction: SpinDirection = ..., period: FiniteDuration = ...)

Everything about an OrbitSpinner that is not the time: the figure, the trail, and how both are drawn.

Everything about an OrbitSpinner that is not the time: the figure, the trail, and how both are drawn.

Bundled rather than listed on OrbitSpinner itself because the list had grown to eleven optional knobs. Every field keeps the default it had as an OrbitSpinner constructor parameter, so OrbitSpinnerOptions() is the figure 0.14.0 drew by default.

Value parameters

arcStyle

the style of the lit arc; under OrbitTrail.Comet without a ramp it is dimmed toward the tail

direction

which way round the orbit travels

marker

read at CanvasResolution.Cell only — the glyph each hit cell is drawn with there

path

the closed loop the arc travels

period

how long one lap takes

radius

the figure's radius in DOTS, not cells, because that is the resolution the shape is drawn at. None — the default — fits the figure to its area, staying round

resolution

the sub-cell resolution the figure is drawn at; CanvasResolution.Cell with an ASCII marker is the floor

style

the style of the resting path — the dots no part of the arc is currently on

sweep

the fraction of the lap that is lit, in [0, 1]; 1.0 lights everything and stops the motion — the family's static "queued" state

thickness

how many concentric bands the figure is drawn with, inset a dot at a time

trail

how the arc is shaded along its length

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
enum OrbitTrail

How the travelling arc is shaded along its length.

How the travelling arc is shaded along its length.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
enum Overflow

What a widget does with content that does not fit the width it is given — used by Paragraph for its text and by Notice for its message.

What a widget does with content that does not fit the width it is given — used by Paragraph for its text and by Notice for its message.

This is a named choice rather than a wrap: Boolean because the two spellings read the same at a call site (Paragraph(text, wrap = false) and Paragraph(text, Overflow.Clip) are the same picture) but only one of them survives a reader who has never seen the parameter list: true says nothing about which behaviour is on.

Three of the four cases wrap, and they differ in one decision only: what happens to the blanks at the head of a row. That decision has no right answer, because it depends on whether the caller's indentation carries meaning. An indented bullet list wrapped at width 12 shows all three:

source text:   "  * a long bullet"

Wrap           "  * a long"     the line's own indent is kept, the blank the break landed on is dropped
              "bullet"

WrapTrimmed    "* a long"       every row starts flush against the left edge, indent included
              "bullet"

WrapPreserved  "  * a long"     nothing is ever dropped, so the break blank re-indents the next row
              " bullet"

Pick Wrap for a document whose indentation is structure and whose breaks are incidental — which is nearly always. Pick WrapTrimmed for prose pasted in with an indent nobody wants on screen. Pick WrapPreserved when the text is a rendering of something whitespace-significant and dropping a blank would misrepresent it.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Padding(left: Int, right: Int, top: Int, bottom: Int)

Blank cells reserved on each side of a widget's content, in terminal cells.

Blank cells reserved on each side of a widget's content, in terminal cells.

Per-side rather than one number because the two axes are not interchangeable in a terminal: a cell is roughly twice as tall as it is wide, and a screen is 24 rows against 80 columns, so one row of vertical padding costs about four times as much of the display as one column of horizontal padding does. Negative counts are treated as zero by every consumer, the same way io.worxbend.tui.core.Layout treats a negative spacing.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Padding

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Padding.type
final case class Paginator(current: Int, total: Int, style: Style = ..., highlightStyle: Style = ...) extends Widget

A compact page indicator: dots for small totals, page/total otherwise. Pages are 1-based for display.

A compact page indicator: dots for small totals, page/total otherwise. Pages are 1-based for display.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
final case class Paging(size: Int, page: Int)

A page window over a DataTable: how many rows a page holds, and which page is showing.

A page window over a DataTable: how many rows a page holds, and which page is showing.

Also a pair for a reason: a page number with no page size describes nothing the widget can render, which is what a separate pageSize: Option[Int] plus page: Int allowed anyone to write.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final class Painter

Paints world-coordinate points into terminal cells for one Canvas render, accumulating sub-pixel hits and flushing them as glyphs.

Paints world-coordinate points into terminal cells for one Canvas render, accumulating sub-pixel hits and flushing them as glyphs.

The dot accumulation and the flush are SubCellSurface's; what is this widget's own is the world-to-dot mapping and the last-writer-wins style per cell. Last-writer-wins is right here and wrong for DotGrid for the reason spelled out there: a canvas plots independent points, so which of two points sharing a cell wins carries no meaning. At CanvasResolution.HalfBlock "sharing a cell" is narrower than it sounds — the upper and lower halves are coloured separately, so two points stacked in one cell keep both of their colours and only two points in the same half compete.

Two coordinate systems meet here, and it is worth naming both. World coordinates are the numbers a Shape speaks in — whatever xBounds/yBounds the canvas was given, with y pointing up the way a graph's y axis does. Dot coordinates are integer positions on the sub-cell grid the surface actually lights: column 0 is the left edge, row 0 is the top edge, and how many dots fit in a cell depends on the CanvasResolution. A shape that wants to scan-convert — walk a shape dot by dot rather than guess a sample count — works in dot space, via getPoint, paintDot, bounds and dotSize.

One painter is created per Canvas render and is used on the render thread only; it is never shared or retained.

Attributes

Supertypes
class Object
trait Matchable
class Any
final case class Paragraph(text: Text, alignment: Alignment = ..., overflow: Overflow = ..., scrollY: Int = ..., scrollX: Int = ..., style: Style = ...) extends Widget, Measured

Multi-line styled text with alignment and optional wrapping.

Multi-line styled text with alignment and optional wrapping.

alignment places every line, and it is the last word rather than the first: a Line that carries an alignment of its own overrides it for that one row, and failing that the Text's own alignment overrides it for every row. A wrapped line keeps its alignment on every row it spills onto.

style is likewise the outermost style layer, not the only one. Every character is drawn with this style, then the text's own io.worxbend.tui.core.Text.style on top of it, then the line's, then the span's — each step a io.worxbend.tui.core.Style.patch, so the more specific layer wins wherever it speaks. A Paragraph given a style therefore no longer erases a style the Text was built with; it sits underneath it.

With Overflow.Wrap the text breaks at word boundaries: a word moves to the next row whole rather than being cut in half, and the blanks that sat at the break are dropped instead of becoming a stray indent on the next row. A word longer than the whole width has nowhere to go, so that one is broken between grapheme clusters — never inside one, so a wide character or emoji is never split. With Overflow.Clip, the default, long lines are cut at the area edge. Overflow.WrapTrimmed and Overflow.WrapPreserved wrap the same way and differ only in what becomes of the blanks at the head of a row — see Overflow for the three renderings side by side.

A line that is still wider than the area — one that is clipped, or a single unbreakable word — loses the side away from its alignment: a right-aligned line keeps its end, a centred one loses as much from each side, and a left-aligned one keeps its beginning. Keeping the beginning of a right-aligned line would hide exactly the part the alignment was chosen to show, which for a path or a timestamp is the part that identifies it.

scrollY and scrollX make the area a window into a larger document rather than the whole of it. scrollY skips that many composed rows before drawing: with Overflow.Wrap those are wrapped rows, not source lines, so scrolling a reflowed document by one moves the view by exactly one screen row whatever the width — which is the case ScrollView cannot express, because it scrolls a rendered widget and has to be told its content height. scrollX skips that many columns from the start of every row it draws, which only has anything to skip under Overflow.Clip: wrapped rows are never wider than the area. Both are clamped at zero, and scrolling past the end of the text leaves the area blank rather than failing.

style is the paragraph's own style, and it is painted over the whole area — not only the cells that carry a character. A paragraph given a background colour therefore reads as a block of colour with text in it, which is what a caller sets a background for; each span's style is then layered on top of it for the text itself.

heightAt reports the rows the paragraph needs from the same overflow field render draws with, so the two cannot disagree about whether the text wraps. Measurement memoization belongs to this immutable value: it keeps one height answer (the latest width) and one natural width, not rows or a global content index. Copies/rebuilt paragraphs start fresh, and the text must obey its immutable collection contract. Rendering never forces either measurement. Concurrent measurements are safe; rendering still inherits Buffer's caller-owned confinement.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait Measured
trait Widget
class Object
trait Matchable
class Any
Show all
object Paragraph

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Paragraph.type
object PasteText

Line-ending policies for bracketed and clipboard paste. Pure and backend-independent.

Line-ending policies for bracketed and clipboard paste. Pure and backend-independent.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
PasteText.type
final case class Patch(files: Seq[FilePatch], approximate: Boolean = ...)

A unified diff: one FilePatch per file, in order — what git diff prints, read by Patch.parse, or the difference between two texts computed by Patch.of. An immutable value, safe to share between threads; drawn by DiffView.

A unified diff: one FilePatch per file, in order — what git diff prints, read by Patch.parse, or the difference between two texts computed by Patch.of. An immutable value, safe to share between threads; drawn by DiffView.

approximate is true for a Patch.of that passed its edit-distance cap: the patch still turns the old text into the new one, but the part the cap cut short is one block of removals followed by one of additions rather than a line-by-line comparison. A DiffView says so on its first row.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Patch

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Patch.type
final case class PatchError(line: Int, message: String)

Why Patch.parse gave up: line is the 1-based line of the input it could not make sense of.

Why Patch.parse gave up: line is the 1-based line of the input it could not make sense of.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class PieChart(data: Seq[(String, Double)], styles: Seq[Style] = ..., showLegend: Boolean = ...) extends Widget

A filled pie: angular sectors proportional to each value, plus a legend when width allows.

A filled pie: angular sectors proportional to each value, plus a legend when width allows.

Cells are roughly half as tall as they are wide, so the disc corrects the aspect ratio to look circular.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
final case class PixelImage(image: RgbaImage, options: PixelImageOptions = ...) extends Widget, Measured

A picture drawn by the terminal itself — the kitty graphics protocol or iTerm2 inline images — with a half-block rendering in the cells for every terminal that can do neither.

A picture drawn by the terminal itself — the kitty graphics protocol or iTerm2 inline images — with a half-block rendering in the cells for every terminal that can do neither.

Rendering does two things, in this order: it draws the half-block fallback (two pixels per cell, ▀ with the upper pixel as foreground and the lower as background, as the Image widget does), then places the picture over those same cells with io.worxbend.tui.core.Buffer.placeGraphic. Which one the user sees is the backend's decision, made from what the terminal answered at start-up: a terminal that draws pictures gets the picture and the fallback cells are never flushed; any other terminal gets the fallback as ordinary text. Something drawn over the picture later in the frame — a popup, a menu — takes the picture down until it goes away again.

The widget is backend-agnostic and immutable. image should be shared between frames rather than rebuilt: the terminal caches each picture's encoding by value, and an unchanged picture in an unchanged box sends nothing.

Measured under ImageFit.Contain: it knows how many rows a width needs to keep the picture's shape, and the reverse. A stretched picture fits whatever it is given, so it cannot say.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Measured
trait Widget
class Object
trait Matchable
class Any
Show all
final case class PixelImageOptions(fit: ImageFit = ..., cellAspect: Double = ..., background: Rgb = ...)

The appearance knobs of a PixelImage. PixelImageOptions() is the widget its bare constructor draws.

The appearance knobs of a PixelImage. PixelImageOptions() is the widget its bare constructor draws.

Value parameters

background

the colour translucent pixels are blended over in the half-block fallback. A picture protocol blends over the real cells instead.

cellAspect

how many times taller than wide one terminal cell is, used to keep the picture's shape under ImageFit.Contain. Two is what nearly every monospace font gives; a widget cannot ask the terminal, because widgets never see one.

fit

how the picture fits the area; see ImageFit.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Placeholder(label: String, style: Style = ..., labelStyle: Style = ..., borderType: BorderType = ...) extends Widget

A sized, labelled box for prototyping a layout before the real content exists: a dashed frame, the label centred inside it, and under the label the size the box was actually given — 40×12 — so a reader tuning constraints sees what the solver handed out without reaching for a debugger.

A sized, labelled box for prototyping a layout before the real content exists: a dashed frame, the label centred inside it, and under the label the size the box was actually given — 40×12 — so a reader tuning constraints sees what the solver handed out without reaching for a debugger.

The size is the whole area's, frame included, because that is the number a Constraint controls. An area under three cells in either direction has no room for a frame; the label and the size are then drawn unframed from the top-left corner, clipped like everything else. Every width is measured through CharWidth, so a CJK or emoji label centres on its display width.

Stateless and immutable; safe to share between frames and threads.

Value parameters

borderType

the frame's glyphs; dashed by default, so a placeholder reads as provisional next to the finished panels beside it

label

what the box stands in for — "Sidebar", "Chart goes here"

labelStyle

layered over style for the label alone

style

the style of the frame and of the size line, painted over the whole area

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all

A value described for display — the input of Inspect.

A value described for display — the input of Inspect.

Four shapes cover any Scala value: an PrettyValue.Atom is already text (a number, a quoted string, None); a PrettyValue.Seq is a named collection of items (List, Vector, Some); a PrettyValue.Map pairs keys with values; a PrettyValue.Product is a named record of labelled fields (a case class, an enum case — with no fields, a case object). tui-macros' Pretty[A] derives this description for case classes, enums and sealed hierarchies without reflection, and the DSL's inspect(value) glues the two; build one by hand for anything else.

Plain immutable data, safe to share between threads.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
enum
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type

One column of a MultiProgress row: what it reads off a ProgressTask and how it prints it.

One column of a MultiProgress row: what it reads off a ProgressTask and how it prints it.

Every column except Bar is text, measured with CharWidth and padded to the widest value any row of the table produces, so a column lines up down the table. Numeric columns are right-aligned, Description is left-aligned. A value that cannot be known yet — an ETA before any progress, a percentage of an unknown total — prints a placeholder (-, --:--) rather than a zero, because a zero is a claim.

Attributes

Companion
object
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

What a progress meter writes beside its bar.

What a progress meter writes beside its bar.

A named ADT rather than an Option[String], because that option had to carry three meanings — absent for the percentage, present for custom text, and present-but-empty for no caption at all. The third is the kind of sentinel a reader cannot guess and a type cannot check, and it forced the widget to treat Some("") specially anyway.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class ProgressPreset(name: String, fill: String, track: String, partials: Vector[String] = ..., head: Option[String] = ...)

The glyph vocabulary a progress bar draws with: what a filled cell looks like, what an empty one looks like, and optionally how to draw the cell the boundary falls inside.

The glyph vocabulary a progress bar draws with: what a filled cell looks like, what an empty one looks like, and optionally how to draw the cell the boundary falls inside.

partials is what separates a bar that steps a whole cell at a time from one that moves smoothly. Ordered narrowest to widest and excluding fill itself, it lets a bar show progress finer than its own cell grid: eight partial blocks turn a 20-column bar into 160 distinguishable positions. Leave it empty and the bar rounds to whole cells, which is the right choice for vocabularies with no partial glyphs (#, =) and for a bar one or two cells wide, where a partial glyph reads as noise.

That distinction is also why the two cases round differently, and it is deliberate: with partials the fill is floored and the remainder becomes the boundary glyph, so the bar never claims progress that has not happened; without them it rounds to nearest, because that is the closest a whole cell can get.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
final class ProgressTask(initialLabel: String, initialTotal: Option[Long] = ..., clock: () => FiniteDuration = ..., rateWindow: Option[FiniteDuration] = ...) extends VersionedState

Caller-owned progress of one unit of work — what a MultiProgress row reads.

Caller-owned progress of one unit of work — what a MultiProgress row reads.

Holds the four things a progress column can be computed from: a label, an optional total (None for work whose size is not known up front), the completed count, and the start/finish stamps. Everything a column shows — the fraction, the elapsed time, the rate, the ETA — is derived from those on read, so there is nothing to keep in step.

Time comes from clock, read whenever the task stamps a start or a finish and whenever an estimate is asked for. The default is the monotonic system clock; a test passes a clock it moves by hand (ManualClock.elapsed in tui-test), which is what makes an ETA assertion exact. Only differences between two readings are used, so the origin is irrelevant.

The rate is measured over a sliding window, rateWindow (ten seconds by default): the units completed since the last progress report at or before the window's start, over the time since that report. A download that speeds up or a build stage that slows down shows in the rate and the ETA within one window instead of averaging away, and a stall longer than the window makes both unknown. rateWindow = None keeps the average since the start, which settles rather than reacts. Reports coalesce into window/64 time buckets, retaining at most 66 samples including the start and window anchors. Windowed estimates are approximate to one bucket; reporting and reads have bounded amortized cost even for a CPU-cheap task that reports millions of times per window. completed is clamped into [0, total] on every write.

'''Threads.''' Render-thread-only, like every widget state: a worker reports progress by posting task.advance(n) back onto the render thread (RenderThread.capture() / Async), not by calling it directly. Every mutation raises version (see io.worxbend.tui.core.Versioned), so a DSL view painting the task notices a write made outside the event path and redraws.

Value parameters

clock

the time source; defaults to System.nanoTime

initialLabel

the description column's text

initialTotal

how many units the work has, or None when that is unknown

rateWindow

how far back rate and eta look; None averages over the whole run

Attributes

Companion
object
Supertypes
trait VersionedState
trait Versioned
class Object
trait Matchable
class Any
object ProgressTask

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
final case class PromptComposer(showCursor: Boolean = ..., style: Style = ..., promptGlyph: String = ..., reverseLabel: String = ...) extends StatefulWidget[PromptComposerState]

Backend-independent composer painting over caller-owned state. Render-thread-only. A host can place the completion list in a portal using popupAt and popupWidget; the base render never paints outside its area.

Backend-independent composer painting over caller-owned state. Render-thread-only. A host can place the completion list in a portal using popupAt and popupWidget; the base render never paints outside its area.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait StatefulWidget[PromptComposerState]
class Object
trait Matchable
class Any
Show all
final class PromptComposerState(initialHistory: Seq[String] = ..., val completions: (Char, String) => Seq[String] = ..., val debounce: FiniteDuration = ..., val pasteLines: Int = ..., val maxRows: Int = ...) extends Versioned

Caller-owned state of a PromptComposer: the multi-line draft, the submission history, the open reverse search or completion popup, and the large pastes folded into placeholders.

Caller-owned state of a PromptComposer: the multi-line draft, the submission history, the open reverse search or completion popup, and the large pastes folded into placeholders.

Create it once outside view. Render-thread-only, like every widget state; the completion provider is the one piece that the host executes elsewhere. The DSL adapter debounces it and delivers latest-wins on the owning render thread; the widget itself depends only on core and owns no executor, task scope or backend.

Value parameters

completions

answers the candidates for a trigger ('/' at the start of the prompt, '@' at the start of a word) and the query typed after it. Runs on a worker thread, so it may block on IO; it must not touch UI state.

debounce

how long typing must pause before the provider is asked

initialHistory

earlier submissions, oldest first; each submission is appended

maxRows

the most rows the draft grows to before it scrolls Versioned over its own fields as well as the draft: version is the editor's version plus a count of this state's own writes (history recall, the reverse search, the completion popup, pastes, submits), so any of them made between frames schedules the frame that shows it.

pasteLines

a bracketed paste of at least this many lines is shown as a [Pasted N lines] placeholder and expanded on submit

Attributes

Companion
object
Supertypes
trait Versioned
class Object
trait Matchable
class Any

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
final case class QrCode(text: String, ecc: QrEcc = ..., quietZone: Int = ..., darkColor: Color = ..., lightColor: Color = ...) extends Widget, Measured

A scannable QR code for text, drawn two modules to a cell with half-block glyphs (▀, ▄, █), so a version-1 code with its quiet zone is 25 columns by 13 rows.

A scannable QR code for text, drawn two modules to a cell with half-block glyphs (▀, ▄, █), so a version-1 code with its quiet zone is 25 columns by 13 rows.

The text is encoded as UTF-8 in byte mode at the smallest version from 1 to 10 that holds it at ecc — up to 271 bytes at QrEcc.Low, 119 at QrEcc.High. Text longer than that draws the notice QR: too long instead, cut to the area. Every module is painted with an explicit foreground and background, darkColor on lightColor, because a reader needs dark modules on a light ground and cannot be left to whatever the terminal's own background happens to be. A code is only readable whole; in an area smaller than widthAt × heightAt the widget still clips safely, but the result will not scan.

The symbol is encoded once, when the widget is built; rendering only copies it. Immutable and thread-safe.

Value parameters

darkColor

the dark modules

ecc

how much damage the code survives, traded against capacity

lightColor

the light modules and the quiet zone

quietZone

blank modules around the symbol on every side. The standard asks for 4; 2 is usually enough on a screen

text

what the code carries — a URL, a pairing token, a Wi-Fi string

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait Measured
trait Widget
class Object
trait Matchable
class Any
Show all
object QrCode

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
QrCode.type
enum QrEcc

The error-correction level of a QrCode: how much of the symbol can be damaged and still read, traded against how much data fits. Roughly 7 %, 15 %, 25 % and 30 % of codewords recoverable.

The error-correction level of a QrCode: how much of the symbol can be damaged and still read, traded against how much data fits. Roughly 7 %, 15 %, 25 % and 30 % of codewords recoverable.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final class QrMatrix

An encoded QR symbol: size × size modules, dark(x, y) for each, plus the version and mask chosen.

An encoded QR symbol: size × size modules, dark(x, y) for each, plus the version and mask chosen.

Immutable once built. The module grid is the symbol alone, without the quiet zone a reader needs around it — that is the renderer's to add.

Attributes

Supertypes
class Object
trait Matchable
class Any
final case class RadioGroup(options: Seq[String], selected: Int, style: Style = ..., highlightStyle: Style = ...) extends Widget

A vertical set of mutually exclusive options, one marked (•). Stateless — selection lives with the app.

A vertical set of mutually exclusive options, one marked (•). Stateless — selection lives with the app.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
final case class RangeSlider(style: Style = ..., rangeStyle: Style = ..., thumbStyle: Style = ..., focusedThumbStyle: Style = ...) extends StatefulWidget[RangeSliderState]

A one-row slider with two thumbs, ├─●━━━━●─┤: the stretch between them drawn heavy in rangeStyle, the thumb the keyboard moves in focusedThumbStyle.

A one-row slider with two thumbs, ├─●━━━━●─┤: the stretch between them drawn heavy in rangeStyle, the thumb the keyboard moves in focusedThumbStyle.

The widget only draws; the DSL's rangeSlider node moves the focused thumb with Left/Right/Home/End and switches thumbs with Tab/Shift+Tab. Needs three columns — two end caps and one track cell — and draws nothing in less. When both thumbs land on one cell the focused one is drawn.

Value parameters

focusedThumbStyle

the thumb that does

rangeStyle

the selected stretch between the thumbs

style

the end caps and the track outside the selection

thumbStyle

the thumb that does not have the keyboard

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait StatefulWidget[RangeSliderState]
class Object
trait Matchable
class Any
Show all
final class RangeSliderState(val range: SliderRange, initialLow: Int, initialHigh: Int, minGap: Int = ...) extends VersionedState

Caller-owned state of a RangeSlider: the two values, the minimum distance between them, and which thumb has the keyboard.

Caller-owned state of a RangeSlider: the two values, the minimum distance between them, and which thumb has the keyboard.

The invariant range.min <= low, low + minGap <= high, high <= range.max holds after every call, so the thumbs can meet (with minGap = 0) but never cross: a thumb pushed into the other one stops there. A minGap larger than the whole range is cut down to the range. The constructor orders and clamps what it is handed rather than rejecting it, as SliderRange.of orders its bounds.

Render-thread-only. Every mutation raises version (see io.worxbend.tui.core.Versioned), so a write made outside the event path is painted too, with no Signal write.

Value parameters

initialHigh

the upper thumb's starting value

initialLow

the lower thumb's starting value

minGap

how close the two values may come; 0 lets them meet

range

the bounds and the per-press step

Attributes

Supertypes
trait VersionedState
trait Versioned
class Object
trait Matchable
class Any
enum RangeThumb

Which thumb of a RangeSlider the keyboard moves.

Which thumb of a RangeSlider the keyboard moves.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Row(items: Seq[LayoutItem], spacing: Int = ..., flex: Flex = ..., crossAlign: CrossAlign = ...) extends Widget, Measured

Lays its items out left-to-right using the core constraint solver and renders each into its segment.

Lays its items out left-to-right using the core constraint solver and renders each into its segment.

An item constrained Constraint.Auto gets the columns its widget measures through Measured.widthAt; each item is placed vertically by its own align or by crossAlign (the default, Stretch, gives it the row's full height).

Measurement uses the identical horizontal allocation. A zero-width child contributes zero (render skips it); any visible unmeasurable child makes the row unmeasurable. Its width is the sum of its items' — each a Length or its widget's own measurement — plus the gaps.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Measured
trait Widget
class Object
trait Matchable
class Any
Show all
final case class Rule(label: Option[String] = ..., orientation: Direction = ..., style: Style = ..., labelStyle: Style = ..., borderType: BorderType = ...) extends Widget

A separator line with an optional inline label: ── label ─────. Vertical rules ignore the label.

A separator line with an optional inline label: ── label ─────. Vertical rules ignore the label.

borderType picks the weight of the line from the same set Block frames itself with, so a divider inside a panel matches the panel around it. BorderType.Rounded draws the plain run: rounding only affects corners, and a rule has none.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
final case class ScrollView(content: Widget, contentHeight: Int, showScrollbar: Boolean = ..., contentIdentity: Option[Any] = ..., matchStyle: Style = ..., currentMatchStyle: Style = ...) extends StatefulWidget[ScrollViewState]

A vertically scrollable window over content taller than the viewport.

A vertically scrollable window over content taller than the viewport.

Each frame the content is handed its full contentHeight rect — it lays itself out as if all of it were on screen — but the offscreen buffer it draws into covers only the scrolled-to window, so rows above and below are clipped by the buffer's own bounds instead of being drawn and thrown away. That keeps the per-frame cost proportional to the viewport rather than to the document: a 10 000-row content used to allocate two 2-million-element arrays and fill them on every keystroke. The window is then blitted into place and a scrollbar drawn on the right edge when the content overflows. Content height is explicit (the caller knows its data) — an intrinsic-measure pass is future work.

contentIdentity matters only to a searched view: it is an equality-comparable stand-in for what content draws, for a caller that rebuilds the content widget every frame (the DSL does). None means the content widget itself is the identity. Two renders whose identity, size and query are equal reuse the matches the first one found.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait StatefulWidget[ScrollViewState]
class Object
trait Matchable
class Any
Show all
final class ScrollViewState extends VersionedState

Caller-owned scroll offset for a ScrollView.

Caller-owned scroll offset for a ScrollView.

Render-thread-only. Every mutation raises version (see io.worxbend.tui.core.Versioned), so a DSL node that paints this state notices a write made outside the event path — a background result applied on the render thread — and schedules the frame that shows it, with no Signal write and no requestRedraw().

Attributes

Supertypes
trait VersionedState
trait Versioned
class Object
trait Matchable
class Any
final case class Scrollbar(contentLength: Int, position: Int = ..., options: ScrollbarOptions = ...) extends Widget

A scrollbar strip: a vertical bar down one of the area's side edges, or a horizontal bar along its top or bottom edge. Which of the two options.side picks; by default it is the conventional right edge or bottom edge.

A scrollbar strip: a vertical bar down one of the area's side edges, or a horizontal bar along its top or bottom edge. Which of the two options.side picks; by default it is the conventional right edge or bottom edge.

The thumb's size is proportional to how much of the content the viewport covers. When the content fits entirely there is nothing to scroll, and by default only the bare track is drawn; options.thumbWhenFits asks for a full-length thumb instead.

Stateless on purpose. In this toolkit a StatefulWidget is a widget whose render adjusts caller-owned state — a list scrolling itself to keep its selection visible, for instance. A scrollbar adjusts nothing: where the thumb goes is a pure function of contentLength, position and the area it is given, so both numbers are passed in as ordinary parameters and the caller keeps whatever state it already had.

Value parameters

contentLength

the full extent of the content being scrolled, in rows (vertical) or columns (horizontal)

position

how far into the content the viewport starts, in the same units; clamped, so an out-of-range value pins the thumb to an end rather than drawing it off the track

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
object Scrollbar

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Scrollbar.type
final case class ScrollbarOptions(orientation: Direction = ..., style: Style = ..., thumbStyle: Style = ..., trackSymbol: String = ..., thumbSymbol: String = ..., viewportLength: Option[Int] = ..., side: ScrollbarSide = ..., thumbWhenFits: Boolean = ..., capStyle: Style = ..., beginSymbol: Option[String] = ..., endSymbol: Option[String] = ...)

Everything about a Scrollbar that is not the scroll position itself: orientation, look, and the sizing hints.

Everything about a Scrollbar that is not the scroll position itself: orientation, look, and the sizing hints.

Bundled rather than listed on Scrollbar itself because the list had grown to eleven optional knobs. Every field keeps the default it had as a Scrollbar constructor parameter, so ScrollbarOptions() is the bar 0.14.0 drew by default.

Value parameters

beginSymbol

an arrow cap drawn in the strip's first cell — the top of a vertical bar, the left end of a horizontal one. Each cap takes a cell away from the track, so a 10-row bar with both caps places its thumb in 8 rows. None, the default, means no cap and a whole strip of track, which is what this widget has always drawn. ScrollbarSymbols collects the conventional glyph sets, and Scrollbar.withSymbols builds a bar from one of them.

capStyle

the style of the two arrow caps, when there are any

endSymbol

an arrow cap drawn in the strip's last cell, or None

orientation

vertical down a side edge, or horizontal along the top or bottom edge

side

which edge of the area the strip lands on, read along its own axis: Far — the default — is the right edge of a vertical bar and the bottom edge of a horizontal one, Near the left edge and the top edge

style

the style of the track cells

thumbStyle

the style of the thumb cells

thumbSymbol

the glyph drawn for each thumb cell

thumbWhenFits

what to draw when all of the content is on screen. false — the default — leaves a bare track. true fills the whole track with the thumb, which is the conventional "you are seeing all of it" affordance and stops the strip flipping between bare track and thumb as the content grows past the viewport by a single row.

trackSymbol

the glyph drawn for each track cell

viewportLength

how much of the content the reader can actually see, in the same units as the content length. None — the default — means "as much as the bar itself is long", which is right whenever the strip runs the full height (or width) of the content it describes. Pass a value when it does not: a bar drawn beside a bordered pane covers two rows more than the pane shows, and a bar sharing its column with a header covers one row more. Getting this wrong makes the thumb the wrong length and stops it reaching the end of the track.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Which of the two edges available to its axis a Scrollbar draws on.

Which of the two edges available to its axis a Scrollbar draws on.

The sides are named by position along the axis rather than by compass point, so one type serves both orientations: Far is the right edge of a vertical bar and the bottom edge of a horizontal one, Near the left edge and the top edge. Naming them this way also keeps core.Direction a plain axis with no opinion about sides.

Far is the conventional placement and the default, so a caller that says nothing keeps the bar exactly where it has always been. Near is for a left-hand gutter beside content, or a horizontal ruler drawn above it.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
final case class ScrollbarSymbols(track: String, thumb: String, begin: Option[String] = ..., end: Option[String] = ...)

The glyphs a Scrollbar paints with: the track it draws along its whole length, the thumb it draws over the part of the track the viewport covers, and two optional arrow caps drawn in the strip's first and last cell.

The glyphs a Scrollbar paints with: the track it draws along its whole length, the thumb it draws over the part of the track the viewport covers, and two optional arrow caps drawn in the strip's first and last cell.

A cap costs a cell of track, so a bar with both caps has two fewer cells to place the thumb in. None — no cap — is therefore the right choice for a short strip, and for a terminal whose font has no arrow glyphs; it is also what a Scrollbar draws when nothing is overridden, so the presets below are opt-in and change nothing on their own.

A plain immutable value with no state and no thread constraints: build one anywhere, share it freely.

Value parameters

begin

the cap drawn in the first cell of the strip — the top of a vertical bar, the left end of a horizontal one — or None for no cap, leaving that cell as ordinary track

end

the cap drawn in the last cell of the strip, or None

thumb

the cell drawn where the thumb is

track

the cell drawn everywhere the thumb is not

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class SearchMatch(row: Int, column: Int, width: Int)

One occurrence of a search query in a searched view: width columns starting at display column column of content row row. Rows and columns are in the view's content coordinates — a log's line index, a scroll view's content row, a wrapped widget's row inside its own area — not screen positions, so a match keeps its identity while the view scrolls.

One occurrence of a search query in a searched view: width columns starting at display column column of content row row. Rows and columns are in the view's content coordinates — a log's line index, a scroll view's content row, a wrapped widget's row inside its own area — not screen positions, so a match keeps its identity while the view scrolls.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final class SearchState extends Versioned

Caller-owned incremental search over one scrolling view: the query, the matches the view found for it on its last render, and which of them is current.

Caller-owned incremental search over one scrolling view: the query, the matches the view found for it on its last render, and which of them is current.

The view does the finding. Log, ScrollView and Searchable each take a SearchState in an overload of render, look for the query in what they show — grapheme by grapheme, so a combining sequence, an emoji or a wide CJK character is matched whole and never split, and precomposed and decomposed accents match each other — record the matches here, highlight them, and scroll so the current one is on screen. Matching folds case unless the query holds a capital letter (the smartcase rule TextAreaState uses as well).

When the query changes, the first match at or after the top of the view's window becomes current; next and previous step through the rest, wrapping round. The view scrolls to the current match once per move, so a reader who scrolls away from it is not dragged back on the next frame.

A SearchState records the matches of one view. To search two views with one query — a search bar over a split diff, a log beside its source — hand each view its own view of the state: search.view("left") and search.view("right") share this state's input, so one query reaches both, while each keeps its own matches, current match and scroll-to-match. next, previous and clear on this state reach every view; on a view they act on that view alone. Rendering two views with the same state still makes them overwrite each other's matches.

The query is edited through input, the TextInputState a DSL searchBar(state) types into; query_= sets it in one go.

Render-thread-only. Every mutation — typing into input included — raises version (see Versioned), so a DSL node that paints this state schedules the frame that shows it. Matches recorded by a render do not move it: a frame must not schedule another frame just by having been drawn.

Attributes

Supertypes
trait Versioned
class Object
trait Matchable
class Any
final case class Searchable(content: Widget, contentIdentity: Option[Any] = ..., matchStyle: Style = ..., currentMatchStyle: Style = ...) extends StatefulWidget[SearchState]

Any widget made searchable: draws content, finds the SearchState's query in what it drew — over the whole area, even the part a scroll view's window clips away — and highlights the matches. This is how the DSL searches markdown: the highlight is a restyle of cells already drawn, so a match inside a table cell keeps the table's column alignment.

Any widget made searchable: draws content, finds the SearchState's query in what it drew — over the whole area, even the part a scroll view's window clips away — and highlights the matches. This is how the DSL searches markdown: the highlight is a restyle of cells already drawn, so a match inside a table cell keeps the table's column alignment.

It does not scroll: matches are reported in area-relative content coordinates for the host to reveal. Searching costs one extra paint of content when the buffer does not cover the whole area, once per query, content and area size: later frames reuse the matches. contentIdentity stands in for content in that comparison when the caller rebuilds the widget every frame; None compares the widget itself. Nothing at all without a query.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait StatefulWidget[SearchState]
class Object
trait Matchable
class Any
Show all
final case class Select(options: Seq[String], selected: Int, style: Style = ...) extends Widget

A single-line option cycler (◀ value ▶). Stateless — the selected index lives with the application; left/right key handling belongs to the caller (or the DSL wrapper).

A single-line option cycler (◀ value ▶). Stateless — the selected index lives with the application; left/right key handling belongs to the caller (or the DSL wrapper).

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
object SeriesPalette

Distinct styles cycled across chart series/sectors when the caller does not supply any.

Distinct styles cycled across chart series/sectors when the caller does not supply any.

Public because it is the visible default of the styles parameter on StackedBarChart and PieChart: a default a reader can see in the signature but could not name, extend, or inspect would be worse than no default.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object Shadow

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Shadow.type
final case class Shadow(offsetX: Int = ..., offsetY: Int = ..., style: Style = ..., fill: ShadowFill = ...)

An offset drop shadow: the band of cells a box casts down and to the right of itself.

An offset drop shadow: the band of cells a box casts down and to the right of itself.

This is what makes a dialog or a popup read as floating above the screen rather than cut into it. It is a plain immutable value that knows how to repaint a band of an existing Buffer; it is not a io.worxbend.tui.core.Widget of its own, because a shadow is never the thing being drawn — it is something a widget such as Block casts.

offsetX and offsetY say how far the shadow is displaced, in cells. Positive values put it to the right and below, which is what a light source at the top left produces and what nearly every interface means by a drop shadow; negative values put it to the left and above. Zero on both axes means no shadow at all, and painting one is then a no-op rather than an error.

Rendering only ever writes into bounds and never into box itself, so the widget that casts the shadow can draw itself afterwards without having to repair anything.

Renders into a Buffer and nothing else, so it carries the buffer's thread constraint: paint from the thread that owns the buffer.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
enum ShadowFill

What a shadow does to the cells it falls on.

What a shadow does to the cells it falls on.

Dim is the one that reads as a real shadow over live content: the glyph underneath is kept and only its style changes, so the text behind a floating dialog stays legible while visibly receding. The shade variants overwrite instead, which is the right choice on a terminal that renders the dim attribute as nothing at all — a good many do.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
trait Shape

Something drawable on a Canvas in world coordinates.

Something drawable on a Canvas in world coordinates.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Bars
class CircleShape
class FilledLine
class Points
class Polyline
class SegmentShape
class WorldMap
Show all
object Shape

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Shape.type
final case class Skeleton(elapsed: FiniteDuration, style: Style = ..., bandStyle: Style = ..., baseSymbol: String = ..., bandSymbol: String = ..., bandWidth: Option[Int] = ..., period: FiniteDuration = ...) extends Widget

A pulsing placeholder for content that has not loaded yet (skeleton screen): a base shade with a brighter band sweeping through, positioned from how long the animation has been running.

A pulsing placeholder for content that has not loaded yet (skeleton screen): a base shade with a brighter band sweeping through, positioned from how long the animation has been running.

period is one full sweep, in wall-clock time, so the sweep takes the same time whatever the app's tick rate and whatever the widget's width. bandWidth defaults to a fifth of the area, which keeps the highlight proportional to whatever the skeleton is standing in for; give it an explicit width when several skeletons of different sizes need to pulse in step.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
final case class Slider(value: Int, range: SliderRange = ..., style: Style = ..., knobStyle: Style = ...) extends Widget

A one-row value slider: ├───●──────┤ proportional to value within range.

A one-row value slider: ├───●──────┤ proportional to value within range.

A value outside the range is clamped rather than drawn off the track. range.step is not a rendering input — the widget never reads it — but it travels with the bounds because the DSL's slider needs all three to handle a key press, and the three only make sense together.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
object SliderRange

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
final case class SliderRange

The scale a Slider moves along: its bounds and how far one keyboard press travels.

The scale a Slider moves along: its bounds and how far one keyboard press travels.

One value rather than three loose Int parameters, because two of the three combinations a caller could previously write did not describe anything the control can do. step = 0 was the worse one: the DSL's slider consumes Left/Right by construction, so a zero step swallowed both arrow keys, stopped them bubbling to the application's own bindings, and changed nothing on screen. A negative step silently reversed the arrows. Bounds handed over the wrong way round put the minimum above the maximum, which the render arithmetic then had to guess at.

The constructor is private so those states stay unreachable: build one with SliderRange.of, which orders the bounds and rejects a step below 1 the way ColorRamp and SpinnerPreset reject values they cannot render. That also rules out reopening the hole with .copy(step = 0).

Value parameters

max

the highest value the slider can hold; never below min

min

the lowest value the slider can hold; never above max

step

how many units Left/Right move the value, always at least 1

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Which way a DataTable column is sorted.

Which way a DataTable column is sorted.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case object Spacer extends Widget

Renders nothing — claims layout space to push siblings apart.

Renders nothing — claims layout space to push siblings apart.

Attributes

Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
Self type
Spacer.type

Which end of the area the series is anchored to when it has more points than the area has columns.

Which end of the area the series is anchored to when it has more points than the area has columns.

SparkDirection.LeftToRight keeps the oldest points: the first data point sits in the leftmost column and anything past the right edge is dropped. That is right for a fixed series you want to read from its start.

SparkDirection.RightToLeft keeps the newest points: the last data point sits in the rightmost column and the oldest history scrolls off the left. That is what a live metric wants, because the column the reader watches — the latest reading — never moves.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Sparkline(data: Seq[Long], max: Option[Long] = ..., direction: SparkDirection = ..., absentColumns: Set[Int] = ..., style: Style = ..., styleFor: (Int, Long) => Option[Style] = ..., absentStyle: Style = ..., barSet: BarSet = ..., absentSymbol: Option[String] = ...) extends Widget

A compact bar-per-column chart using the eight block-element glyphs, scaled over the full area height.

A compact bar-per-column chart using the eight block-element glyphs, scaled over the full area height.

Each data point maps to one column. direction decides which end of the series survives when there are more points than columns (see SparkDirection); the default, LeftToRight, keeps the oldest points and clips the newest off the right. max overrides the scale ceiling (defaults to the data's maximum).

The ceiling is taken from the whole series, not from the columns that happen to be visible, so a RightToLeft trace does not silently rescale itself as points leave the left edge.

barSet swaps the glyphs the columns are drawn from — BarSet.Ascii for a terminal with no block elements, BarSet.Solid for blunt whole-cell columns, or a set of your own. Its empty glyph, if it has one, also fills the cells above each column, which is how the sparkline gets a visible track instead of showing whatever was already on the screen behind it.

absentColumns names the positions in data that carry no reading at all — a sensor that was offline, a minute the metric was not collected. A column named there is drawn as absentSymbol rather than as a bar, so a hole in the series reads as a hole. Without it the only way to plot a missing reading is to pass a zero, and a zero is a measurement: "the queue was empty" and "nobody looked at the queue" would draw the same picture. Build the set with Sparkline.ofReadings rather than counting indices by hand.

Value parameters

absentColumns

indices into data — not into the visible columns — that hold no reading. An index outside data is ignored, and the value stored in data at an absent index is never read, so a caller may leave any placeholder there.

absentStyle

the style of that glyph, layered over style styleFor restyles individual columns — (_, value) => Option.when(value > limit)(Style.Default.withFg(Color.Red)) paints a threshold breach red and leaves everything else alone. It is handed the point's index in data (not its screen column, which differs from it whenever a RightToLeft trace has scrolled) and the value, and what it returns is patched over the sparkline's own style, so an override setting only a colour keeps the rest. See BarStyling.

absentSymbol

what to draw down an absent column. None, the default, leaves those cells exactly as they were, which shows the gap as a hole in the trace and lets the sparkline be drawn over an existing background. A glyph such as "·" marks the gap explicitly, which is the clearer choice when the trace has a visible track behind it.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
object Sparkline

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Sparkline.type

Which way round an orbit travels. An enum rather than a signed rate or a reversed: Boolean, so a call site reads as a direction and a reversed orbit is greppable rather than a minus sign away from a typo.

Which way round an orbit travels. An enum rather than a signed rate or a reversed: Boolean, so a call site reads as a direction and a reversed orbit is greppable rather than a minus sign away from a typo.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Spinner(elapsed: FiniteDuration, label: String = ..., preset: SpinnerPreset = ..., style: Style = ..., labelStyle: Option[Style] = ...) extends Widget, Measured

An animation frame indicator, drawn from how long the animation has been running.

An animation frame indicator, drawn from how long the animation has been running.

Stateless by design: the frame is a pure function of elapsed, so nothing here retains state between renders and a test can render any moment directly. Elapsed time rather than a tick count is what makes a preset portable — the same spinner reads the same in an app ticking every 50ms and one ticking every 200ms.

The glyph and the label are styled separately, because they carry different weight: the glyph is the moving part and usually takes the accent color, while the label is ordinary text. labelStyle defaults to style.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Measured
trait Widget
class Object
trait Matchable
class Any
Show all
final case class SpinnerGrid(elapsed: FiniteDuration, preset: SpinnerPreset = ..., phase: GridPhase = ..., style: Style = ..., ramp: Option[ColorRamp] = ...) extends Widget

A block of slots all running the same SpinnerPreset, each offset in time from its neighbours, so the block reads as one animation rather than as many.

A block of slots all running the same SpinnerPreset, each offset in time from its neighbours, so the block reads as one animation rather than as many.

It consumes the preset catalogue rather than extending it, and that is the point of it existing: a preset is a function of time alone and can never carry a spatial offset, while every preset already in the catalogue — braille, block, emoji, and the ASCII ones — becomes an area-filling animation the moment it is put here. SpinnerPreset.Line is this family's ASCII floor.

This is also the one place in the animated family where per-slot colour is free: every slot holds exactly one frame, so ramp shades the block by phase without any of the one-style-per-cell compromise OrbitSpinner has to make.

A slot is preset.width columns wide, so a two-column emoji preset gives half as many slots across rather than overwriting its neighbour. An area narrower than one slot draws nothing rather than a clipped half-glyph.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
final case class SpinnerPreset(name: String, frames: Vector[String], frameDuration: FiniteDuration = ...)

One named spinner animation: the frames to cycle through and how long each frame holds.

One named spinner animation: the frames to cycle through and how long each frame holds.

Frames are reported padded to width, the widest frame's display width, so a spinner whose frames differ in width does not shove its label back and forth every tick. That is the whole reason this is a type rather than a bare Seq[String]: the padding needs the frame set to compute, and a caller passing raw frames cannot do it.

frameDuration is wall-clock, not a tick count, and that is deliberate. A preset cannot see the app's tick rate, so a speed expressed in ticks means the same preset reads as sluggish under tickRate = 200.millis and frantic under 50.millis. Holding each frame for a duration makes an animation look the same in every app that shows it, and lets a slow-ticking app still get a smooth spinner by ticking faster only while one is on screen.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object SpinnerPreset

The built-in spinner animations.

The built-in spinner animations.

Grouped by the glyph repertoire they need, because that is what decides whether a preset is safe on a given terminal: AsciiPresets need nothing, BraillePresets and BlockPresets need a font with the Unicode blocks, and EmojiPresets need color emoji and take two columns per frame.

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
final case class StackedBarChart(data: Seq[(String, Seq[Long])], barWidth: Int = ..., barGap: Int = ..., max: Option[Long] = ..., styles: Seq[Style] = ..., labelStyle: Style = ...) extends Widget

Bars stacked from multiple series: each (label, values) column stacks one segment per series.

Bars stacked from multiple series: each (label, values) column stacks one segment per series.

max pins the top of the scale, the way it does on BarChart and Sparkline. Without it the chart scales to the tallest stack it was handed, which is what makes two of these charts side by side — or the same chart across two frames — silently mean different things: a stack that stays the same size appears to shrink the moment a taller one arrives beside it. Pin both charts to the same ceiling and the heights compare.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all

A pragmatic, dependency-free syntax highlighter over any Lexer. Backend-agnostic and unit-tested against the produced spans.

A pragmatic, dependency-free syntax highlighter over any Lexer. Backend-agnostic and unit-tested against the produced spans.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
final case class SyntaxTheme(keyword: Style = ..., string: Style = ..., number: Style = ..., comment: Style = ..., function: Style = ..., variable: Style = ..., default: Style = ..., inserted: Style = ..., deleted: Style = ...)

Styles for each token kind a Lexer emits; override entries to re-theme.

Styles for each token kind a Lexer emits; override entries to re-theme.

inserted and deleted are the added and removed lines of a patch, and only Lexer.Diff emits them.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Table(rows: Seq[Source], widths: Seq[Constraint], header: Option[Seq[Source]] = ..., footer: Option[Seq[Source]] = ..., columnSpacing: Int = ..., flex: Flex = ..., style: Style = ..., headerStyle: Style = ..., footerStyle: Style = ...) extends Widget

Rows of cells laid out in columns sized by the core constraint solver.

Rows of cells laid out in columns sized by the core constraint solver.

Cells are never wrapped, and rows past the area's bottom edge are clipped, matching the library-wide silent-clipping philosophy.

A cell carrying an alignment of its own — Line.raw("42").rightAligned, and likewise centered — is placed that way inside its own column instead of being written flush against the column's left edge. That is how a column of numbers lines up on its last digit. A cell that says nothing about alignment is left-aligned, which is what every cell did before. The placement is per cell rather than per column because a Line already had somewhere to record it, and a header caption often wants a different placement from the figures underneath it.

Value parameters

flex

where the columns sit when they do not fill the area. Constraints like Length(8) can leave the table narrower than the space it was given; before this parameter the leftover always trailed off the right-hand side, because the widget passed no flex to the layout and took the Flex.Start default. Now a table of fixed-width columns can be centred or right-aligned in its area, the same way a row can. Has no effect when a Fill or Min column is already absorbing the leftover, because then there is none.

footer

an optional summary row — a totals line, a "last updated" note — pinned to the bottom of the area rather than following the last data row. Pinning it is the point: a table whose rows do not fill the area would otherwise leave the totals floating in the middle of the pane. It is laid out on the same solved columns as the body, which is what a separate Table stacked underneath could never guarantee — the moment the widths changed, the two drifted apart. It costs one row of body height. On an area one row tall that already has a header there is no bottom row left to pin it to, so the header wins and the footer is dropped.

footerStyle

the style the footer row is drawn in, bold by default, matching the header.

rows

each row is either a bare sequence of cells — one terminal line tall — or a TableRow, which adds a height, top and bottom margins, and a per-row style. A cell in either shape is a Line covering one column, or a TableCell covering several. All the shapes may appear in the same table; see TableRow and TableCell for what the extra room and the spans are for.

widths

one Constraint per column. An empty sequence means "equal columns": the table counts the cells in the header and in the rows it is about to draw, and gives each column an equal share of the area. That fallback exists because an empty sequence used to render a blank rectangle, and the DSL's table(rows) — whose widths are varargs, so writing none of them is a legal call — landed straight in it.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
object Table

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Table.type
object TableCell

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
TableCell.type
final case class TableCell(content: Line, columnSpan: Int = ...)

One cell of a Table row, and how many columns it covers.

One cell of a Table row, and how many columns it covers.

A Table accepts either a bare Line — a cell in one column, which is all a cell could be before this type existed — or a TableCell, and the two may be mixed in one row. That union is the same shape TableRow and ListView use, so nothing written against the older signature has to change.

A spanning cell is what a grouped header is made of. Given four columns, a header row of TableCell(Line.raw("in"), 2), TableCell(Line.raw("out"), 2) writes two captions each centred over its own pair of data columns. Without spans the only way to draw that was a second Table stacked above the first with its own, hand-matched width constraints — which drifted apart from the real ones the moment either was edited. A full-width note row inside the body is the same trick with one cell and a span covering every column.

Value parameters

columnSpan

how many solved columns this cell covers, counting from wherever it lands in its row. The gaps columnSpacing puts between those columns are covered too, because the point is one continuous run of cells rather than several with holes. Clamped to at least one, and to no more than the columns actually remaining in the row: a span that ran off the end would either draw outside the table's area or, worse, silently swallow the cells after it.

content

the cell's text, clipped to the merged width like any other cell. Never wrapped.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

What a GFM table does with a cell wider than the column it was given once the table has been shrunk to the area.

What a GFM table does with a cell wider than the column it was given once the table has been shrunk to the area.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class TableRow(cells: Seq[Source], height: Int = ..., topMargin: Int = ..., bottomMargin: Int = ..., style: Option[Style] = ...)

One row of a Table, with the vertical room it takes and the style it is drawn in.

One row of a Table, with the vertical room it takes and the style it is drawn in.

A Table's rows accepts either a bare sequence of cells — one terminal line tall, which is all a row could ever be before this type existed — or a TableRow, and the two may be mixed in one table. The union follows the shape ListView already uses for its String | Line items: a caller who wants none of this pays no ceremony for it, and every table written against the older signature still compiles and still draws the same thing.

What the extra room buys is spacing a table could not express at all. bottomMargin = 1 on the last header-like row puts a blank line under it; height = 2 gives a row breathing space in a sparse table; topMargin opens a gap above a group of rows.

Value parameters

bottomMargin

blank lines below the row. Negative counts clamp to zero.

cells

the row's cells, laid out on the table's solved column widths. A cell is either a bare Line, which occupies one column, or a TableCell, which can span several. Extra cells beyond the last column are dropped, as they always were.

height

how many terminal lines the row occupies. A cell is a single line of text, so the cells are drawn on the first of those lines and the rest are left blank — this reserves vertical room, it does not wrap text. Clamped to at least one: a zero-height row would draw nothing while still being walked, which is exactly the shape that lets a ten-thousand-row table scan itself looking for something to show.

style

the style this row is drawn in, layered over the table's own style, or None to use the table's style unchanged. This is the per-row level the reference implementations have between the table style and the cell style: before it, a table applied one style to every row and a caller who wanted to tint one of them — a failing check, a stale record — had to restyle every io.worxbend.tui.core.Span in it by hand.

topMargin

blank lines above the row. Negative counts clamp to zero.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object TableRow

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
TableRow.type
object TableRows

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
TableRows.type
abstract class TableRows[K] extends AbstractSeq[KeyedRow[K]], IndexedSeq[KeyedRow[K]]

Rows a DataTable asks for one at a time, for data too large or too remote to hold as a sequence: a million records behind a query, a log indexed on disk. Implement count and apply; the table reads only the rows it can paint — the body window, the selected row's key, the rows of the current page — so rendering costs the viewport and not the data.

Rows a DataTable asks for one at a time, for data too large or too remote to hold as a sequence: a million records behind a query, a log indexed on disk. Implement count and apply; the table reads only the rows it can paint — the body window, the selected row's key, the rows of the current page — so rendering costs the viewport and not the data.

A provider is a Seq[KeyedRow[K]], so it goes wherever a row sequence went, DataTable(columns, rows, widths) included, and a plain Vector of rows needs no adapter at all. Three things follow from that:

  • state.sort and state.filter are offered to the provider first, through view: a provider over a store answers them at the source — ORDER BY, WHERE — with another provider, and the table reads that one a row at a time like any other. A provider that answers None (the default) is sorted and filtered by the table, which walks every row once per sort or filter change and memoises the result in DataTableState.
  • The memoised view is keyed by the provider's identity, as it is for a sequence: keep one provider instance while its contents stand, replace it (or call state.invalidate()) when they change.
  • DataTable.selectKey and a selection whose row has moved since the last frame scan for the key, which is as expensive as the provider makes apply; a selection whose row has not moved is confirmed with one read.

toString names the count rather than printing a million rows. Equality is the sequence's structural equality and is never consulted by the table, which compares providers with eq.

Attributes

Companion
object
Supertypes
trait IndexedSeq[KeyedRow[K]]
trait IndexedSeqOps[KeyedRow[K], IndexedSeq, IndexedSeq[KeyedRow[K]]]
trait IndexedSeq[KeyedRow[K]]
trait IndexedSeqOps[KeyedRow[K], IndexedSeq, IndexedSeq[KeyedRow[K]]]
class AbstractSeq[KeyedRow[K]]
trait Seq[KeyedRow[K]]
trait SeqOps[KeyedRow[K], IndexedSeq, IndexedSeq[KeyedRow[K]]]
trait Iterable[KeyedRow[K]]
class AbstractSeq[KeyedRow[K]]
trait Seq[KeyedRow[K]]
trait Pure
trait Equals
trait SeqOps[KeyedRow[K], IndexedSeq, IndexedSeq[KeyedRow[K]]]
trait PartialFunction[Int, KeyedRow[K]]
trait Int => KeyedRow[K]
class AbstractIterable[KeyedRow[K]]
trait Iterable[KeyedRow[K]]
trait IterableFactoryDefaults[KeyedRow[K], IndexedSeq]
trait IterableOps[KeyedRow[K], IndexedSeq, IndexedSeq[KeyedRow[K]]]
trait IterableOnceOps[KeyedRow[K], IndexedSeq, IndexedSeq[KeyedRow[K]]]
trait IterableOnce[KeyedRow[K]]
class Object
trait Matchable
class Any
Show all
object Tabs

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Tabs.type
final case class Tabs(titles: Seq[Line], selected: Int = ..., style: Style = ..., highlightStyle: Style = ..., divider: String = ..., paddingLeft: String = ..., paddingRight: String = ...) extends Widget, Measured

A single-row tab bar: titles separated by a divider, the selected title highlighted.

A single-row tab bar: titles separated by a divider, the selected title highlighted.

Each title can be given its own left and right padding, and the padding belongs to the tab rather than to the divider: highlightStyle covers it, so a reversed highlight paints a bar the full width of the padded tab instead of hugging the glyphs of the title. That distinction is what separates ▏ Tab ▕ from ▏Tab▕ on screen, and it is also why padding cannot be expressed by widening the divider — a divider is drawn between tabs, so the first and the last tab would get none of it, and no part of it would ever be highlighted.

selected is an index into titles. Any value outside that range — Tabs.NoSelection is the name for one — highlights no tab at all, which is what a tab bar should look like before anything has been opened or while the focus is somewhere else entirely. That is part of this widget's contract and is covered by its tests, rather than an out-of-range index happening to match nothing.

Both paddings are empty by default, which draws exactly what this widget drew before they existed: the default divider carries its own blanks. For the padded look, set the divider to a bare "│" and both paddings to " " — or call Tabs.padded, which does that for you.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait Measured
trait Widget
class Object
trait Matchable
class Any
Show all
object TagInput

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
TagInput.type
final case class TagInput(placeholder: String = ..., showCursor: Boolean = ..., style: Style = ..., chipStyle: Style = ..., suggestionStyle: Style = ..., cursorStyle: Style = ...) extends StatefulWidget[TagInputState]

A tag (chip) field: every committed tag drawn as a tag chip in chipStyle, followed by the text being typed, all laid out by Flow so the chips wrap onto further rows when one fills. The typed text is a TextInput; a suggestion that extends it shows after it in suggestionStyle. With no tags and nothing typed, placeholder shows.

A tag (chip) field: every committed tag drawn as a tag chip in chipStyle, followed by the text being typed, all laid out by Flow so the chips wrap onto further rows when one fills. The typed text is a TextInput; a suggestion that extends it shows after it in suggestionStyle. With no tags and nothing typed, placeholder shows.

heightAt and caretAt replay the same layout for a caller sizing the field or parking the terminal cursor. Stateless apart from the caller-owned TagInputState; render-thread use only.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait StatefulWidget[TagInputState]
class Object
trait Matchable
class Any
Show all
object TagInputState

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
final class TagInputState(initialTags: Seq[String] = ..., val suggestions: Seq[String] = ...) extends Versioned

Caller-owned state of a TagInput: the committed tags, the text being typed (an ordinary TextInputState, so every editing key a text field knows works on it), and the optional suggestions the field completes from.

Caller-owned state of a TagInput: the committed tags, the text being typed (an ordinary TextInputState, so every editing key a text field knows works on it), and the optional suggestions the field completes from.

Render-thread-only and Versioned: its version is its own mutation count plus the input's, so typing a letter moves it as surely as committing a tag does.

Attributes

Companion
object
Supertypes
trait Versioned
class Object
trait Matchable
class Any
object TextArea

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
TextArea.type
final case class TextArea(showCursor: Boolean = ..., style: Style = ..., cursorStyle: Style = ..., options: TextAreaOptions = ...) extends StatefulWidget[TextAreaState]

A multi-line text editor view: vertical and horizontal scroll follow the cursor, which renders as a highlighted cell (showCursor = false for unfocused areas). Syntax highlighting is opt-in through TextAreaOptions.lexer, soft wrap through TextAreaOptions.wrap and a line-number gutter through TextAreaOptions.lineNumbers. An open search (TextAreaState.openSearch) takes the bottom row for its /query prompt.

A multi-line text editor view: vertical and horizontal scroll follow the cursor, which renders as a highlighted cell (showCursor = false for unfocused areas). Syntax highlighting is opt-in through TextAreaOptions.lexer, soft wrap through TextAreaOptions.wrap and a line-number gutter through TextAreaOptions.lineNumbers. An open search (TextAreaState.openSearch) takes the bottom row for its /query prompt.

Without wrap only the rows on screen are visited, each frame, so the cost follows the viewport rather than the document. With wrap every line's row count is needed to place the viewport, but each line's wrap is cached on the state and recomputed only when an edit changed the line (or the width changed), so a frame re-wraps only what was edited.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait StatefulWidget[TextAreaState]
class Object
trait Matchable
class Any
Show all
final case class TextAreaOptions(lexer: Option[Lexer] = ..., wrap: Boolean = ..., lineNumbers: Boolean = ..., syntax: SyntaxTheme = ..., selectionStyle: Style = ..., matchStyle: Style = ..., gutterStyle: Style = ...)

Optional knobs for TextArea; TextAreaOptions() is the plain editor.

Optional knobs for TextArea; TextAreaOptions() is the plain editor.

Value parameters

gutterStyle

the line numbers' style

lexer

highlights each visible line through this Lexer, its token styles patched over the editor's style; None draws every cell in style

lineNumbers

draws a gutter of right-aligned 1-based line numbers, as wide as the largest number plus one column; a wrapped line's continuation rows leave it blank

matchStyle

patched over every match of the state's search query

selectionStyle

patched over the selected clusters

syntax

the token colours the lexer paints with

wrap

soft-wraps long lines at the editor's width — after a space where there is one, between graphemes where there is not — instead of scrolling horizontally. Up/Down then move by wrapped row, keeping the display column.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final class TextAreaState(initial: String = ..., killRing: KillRing = ...) extends EditBuffer

Caller-owned multi-line editing state for TextArea: an EditBuffer of many lines.

Caller-owned multi-line editing state for TextArea: an EditBuffer of many lines.

The cursor is (line, column) in cluster coordinates and can never split a combining sequence or emoji. Edits and line joins re-segment affected lines; a splice inside a newly merged grapheme maps the cursor to that grapheme's end (right affinity), identically for insertion, deletion and either join direction. Undo stores coalesced diffs — see EditBuffer.

Control characters other than the \n that separates lines are dropped on the way in — by the constructor as well as by insert — because a control is zero columns wide but still fills a whole Cell, so storing one desynchronises the backend's cursor model from the terminal's.

Render-thread-only. Every mutation raises version (see io.worxbend.tui.core.Versioned), so a DSL node that paints this state notices a write made outside the event path — a background result applied on the render thread — and schedules the frame that shows it, with no Signal write and no requestRedraw().

Incremental search lives here too: openSearch, updateSearch as the query is typed, then nextMatch and previousMatch; the widget draws the open prompt and underlines matches.

Attributes

Companion
object
Supertypes
class EditBuffer
trait VersionedState
trait Versioned
class Object
trait Matchable
class Any
Show all
object TextAreaState

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
enum TextEffect

What an AnimatedText does to its content over time.

What an AnimatedText does to its content over time.

Each case carries its own knobs rather than AnimatedText carrying the union of all of them, so a call site cannot set a typewriter's cursor on a shimmer and quietly have it ignored.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class TextInput(placeholder: String = ..., showCursor: Boolean = ..., style: Style = ..., cursorStyle: Style = ..., placeholderStyle: Style = ..., selectionStyle: Style = ..., mask: Option[String] = ...) extends StatefulWidget[TextInputState]

A single-line text input with horizontal scrolling and an optional visible cursor.

A single-line text input with horizontal scrolling and an optional visible cursor.

The cursor is drawn by styling the cluster under it (or a trailing space) with cursorStyle — pass showCursor = false for unfocused inputs so only the focused field shows a cursor. A selection paints in selectionStyle.

mask draws every grapheme cluster of the value as that one glyph — Some("•") for a password field — so neither the text nor its display width shows; scrolling, the cursor and caretAt all follow the masked row. The value in the state is untouched, and the placeholder of an empty field is drawn as is. A hidden style instead paints a fixed blank row and reports no caret, so cells, exports and observers never receive the value or its length. The state remains sensitive caller-owned data.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait StatefulWidget[TextInputState]
class Object
trait Matchable
class Any
Show all
final class TextInputState(initial: String = ..., killRing: KillRing = ...) extends EditBuffer

Caller-owned single-line editing state: an EditBuffer holding one line.

Caller-owned single-line editing state: an EditBuffer holding one line.

The text is stored as grapheme clusters, so the cursor can never land inside a combining sequence or split an emoji; the cursor is a cluster index in [0, length] (the top value meaning "append here"). Edits re-segment the line and map the cursor with right affinity: if the splice falls inside a newly merged grapheme, the cursor lands after that grapheme. Selection, word motion, kill ring, clipboard and coalesced undo all come from EditBuffer.

Control characters — line breaks included — are dropped on the way in, by the constructor as well as by insert, because a field is just as often seeded from a file or an HTTP response as it is typed into. A control is zero columns wide but still fills a whole Cell, so storing one desynchronises the backend's cursor model from the terminal's.

Render-thread-only. Every mutation raises version (see io.worxbend.tui.core.Versioned), so a DSL node that paints this state notices a write made outside the event path — a background result applied on the render thread — and schedules the frame that shows it, with no Signal write and no requestRedraw().

Attributes

Supertypes
class EditBuffer
trait VersionedState
trait Versioned
class Object
trait Matchable
class Any
Show all
final case class TextPosition(line: Int, column: Int) extends Ordered[TextPosition]

A position in an EditBuffer: a zero-based line and a column counted in grapheme clusters, where the column equal to the line's length means "end of line". Ordered by line, then column.

A position in an EditBuffer: a zero-based line and a column counted in grapheme clusters, where the column equal to the line's length means "end of line". Ordered by line, then column.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Ordered[TextPosition]
trait Comparable[TextPosition]
class Object
trait Matchable
class Any
Show all
final case class TextRange(start: TextPosition, end: TextPosition)

A half-open range of grapheme positions. EditBuffer.selection supplies the earlier endpoint as start, regardless of the selection's direction. Immutable data; safe to read independently of the buffer's next edit.

A half-open range of grapheme positions. EditBuffer.selection supplies the earlier endpoint as start, regardless of the selection's direction. Immutable data; safe to read independently of the buffer's next edit.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
enum TimeField

One of the fields of a TimePicker, in the order focus moves through them.

One of the fields of a TimePicker, in the order focus moves through them.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class TimePicker(style: Style = ..., highlightStyle: Style = ...) extends StatefulWidget[TimePickerState]

A one-row hh:mm:ss time field with the focused field in highlightStyle.

A one-row hh:mm:ss time field with the focused field in highlightStyle.

The widget only draws; Left/Right moving between fields, Up/Down stepping the time and digits typed into the focused field are the DSL's timePicker node calling TimePickerState's methods. widthFor gives the columns the state needs — 8, or 5 without seconds.

Value parameters

highlightStyle

layered over style on the focused field

style

the digits and separators

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait StatefulWidget[TimePickerState]
class Object
trait Matchable
class Any
Show all
final class TimePickerState(initial: LocalTime, val withSeconds: Boolean = ...) extends VersionedState

Caller-owned state of a TimePicker: the time, and which field the arrows change.

Caller-owned state of a TimePicker: the time, and which field the arrows change.

Stepping a field moves the whole time by that field's unit and wraps round midnight, so one minute up from 23:59 is 00:00 and one hour down from 00:30 is 23:30 — the clock-face reading of "up", not a field that wraps on its own while the others stand still.

Render-thread-only. Every mutation raises version (see io.worxbend.tui.core.Versioned), so a write made outside the event path is painted too, with no Signal write.

Value parameters

initial

the starting time; its nanoseconds are dropped, and its seconds too when withSeconds is off

withSeconds

whether the picker has a seconds field. Without it the time is hh:mm and focus moves between two fields

Attributes

Supertypes
trait VersionedState
trait Versioned
class Object
trait Matchable
class Any

Which horizontal border a BlockTitle is written into.

Which horizontal border a BlockTitle is written into.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Toggle(label: String, on: Boolean, style: Style = ..., onSymbol: String = ..., offSymbol: String = ...) extends Widget

A labeled on/off switch. Stateless — the flag lives with the application.

A labeled on/off switch. Stateless — the flag lives with the application.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Widget
class Object
trait Matchable
class Any
Show all
final case class Toolbar(items: Seq[Widget], focus: Option[Int] = ..., gap: Int = ..., divider: Option[String] = ..., style: Style = ..., dividerStyle: Style = ..., overflowBefore: String = ..., overflowAfter: String = ...) extends Widget, Measured

A one-row strip of controls, drawn on the first row of its area — a toolbar, a segmented button group — laid left to right at each item's natural width (Measured.widthAt; an item that cannot say takes one column), gap blank columns apart, with divider drawn in the middle of every gap when given (gap = 0, divider = Some("│") joins the items into one segmented control).

A one-row strip of controls, drawn on the first row of its area — a toolbar, a segmented button group — laid left to right at each item's natural width (Measured.widthAt; an item that cannot say takes one column), gap blank columns apart, with divider drawn in the middle of every gap when given (gap = 0, divider = Some("│") joins the items into one segmented control).

When the items do not all fit, the strip shows the window of them that does and marks what is cut off: » in the last column when items follow, « at the start when items precede. The window starts at the first item, unless the focus item would fall outside it — then it ends at the focus item, so the control the keyboard is on is always on screen. window and placements replay the same arithmetic for a caller doing its own hit testing.

Stateless and immutable; render-thread use only, like every widget.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait Measured
trait Widget
class Object
trait Matchable
class Any
Show all
object Toolbar

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Toolbar.type
final class ToolbarState extends VersionedState

Caller-owned state of a toolbar's overflow menu: whether the popup listing the controls that did not fit is open.

Caller-owned state of a toolbar's overflow menu: whether the popup listing the controls that did not fit is open.

The Toolbar widget itself only draws the » marker; the DSL's toolbar(state)(buttons*) opens this popup when the marker is clicked and floats the hidden controls in it.

Render-thread-only. Every mutation raises version (see io.worxbend.tui.core.Versioned), so a write made outside the event path is painted too, with no Signal write.

Attributes

Supertypes
trait VersionedState
trait Versioned
class Object
trait Matchable
class Any
final case class Tooltip(text: String, style: Style = ..., borderStyle: Style = ..., borderType: BorderType = ...) extends Widget, Measured

A small bordered popup of help text, meant to be layered near the thing it describes.

A small bordered popup of help text, meant to be layered near the thing it describes.

Stateless: it draws itself into whatever area it is given. Ask widthAt/heightAt for the box to size the overlay to before placing it (the DSL tooltip helper anchors one next to a focused element); neither depends on the other axis, because the text is never wrapped.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Measured
trait Widget
class Object
trait Matchable
class Any
Show all
final case class Tree(nodes: Seq[TreeNode], style: Style = ..., highlightStyle: Style = ...) extends StatefulWidget[TreeState[_]]

A collapsible tree with keyboard-driven selection: branch markers (▸ collapsed, ▾ expanded), two-column indentation per depth, and ListView-style scroll-to-selection.

A collapsible tree with keyboard-driven selection: branch markers (▸ collapsed, ▾ expanded), two-column indentation per depth, and ListView-style scroll-to-selection.

Works with any TreeState whatever its key type: the widget only ever asks the state which of its own rows are expanded and selected.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait StatefulWidget[TreeState[_]]
class Object
trait Matchable
class Any
Show all
object Tree

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Tree.type
final case class TreeNode(label: String, children: Seq[TreeNode] = ..., id: Option[String] = ...)

A node of a Tree: a label plus child nodes, and optionally a stable id.

A node of a Tree: a label plus child nodes, and optionally a stable id.

The id is what TreeState.byId names the node by — the identity a tree needs when its labels repeat (two config directories, two README.md files) and must still expand, collapse and highlight one at a time. It never reaches the screen; a node without one is named by its label.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final class TreeState[K] extends VersionedState

Caller-owned tree state: which branches are expanded, the selected node, and the scroll offset.

Caller-owned tree state: which branches are expanded, the selected node, and the scroll offset.

K is how the state names a node. The positional state TreeState() names it by path — the child index at each level, Seq(1, 0) for the second root's first child — which is right for a tree that never changes shape and wrong for one that does: refresh the nodes with a reordered copy and the same path points at a different node, so the reader's expansion and highlight land on strangers. A keyed state, TreeState.keyed(_.label) or TreeState.byLabelPath, names a node by something the node itself carries, so expansion and selection follow the node across a refresh the way a DataTableState selection follows its KeyedRow key. Keys are compared with == and must be unique within the tree: when two nodes share one, the first in view order is the one navigation treats as selected, and both wear the highlight.

Render-thread-only. Every mutation raises version (see io.worxbend.tui.core.Versioned), so a DSL node that paints this state notices a write made outside the event path — a background result applied on the render thread — and schedules the frame that shows it, with no Signal write and no requestRedraw().

Type parameters

K

the key type; Seq[Int] — the node's path — for the positional TreeState()

Attributes

Companion
object
Supertypes
trait VersionedState
trait Versioned
class Object
trait Matchable
class Any
object TreeState

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
TreeState.type
final case class TreeTable[K](nodes: Seq[TreeNode], columns: Seq[String], cells: K => Seq[String], widths: Seq[Constraint], columnSpacing: Int = ..., style: Style = ..., headerStyle: Style = ..., highlightStyle: Style = ...) extends StatefulWidget[TreeState[K]]

A tree whose rows carry columns: Tree's expandable hierarchy in the first column, and a DataTable-style grid of cells beside it — a file browser with sizes, a process tree with CPU and memory, a dependency tree with versions.

A tree whose rows carry columns: Tree's expandable hierarchy in the first column, and a DataTable-style grid of cells beside it — a file browser with sizes, a process tree with CPU and memory, a dependency tree with versions.

Expansion, selection and scrolling are a TreeState, exactly as for a Tree, so the same keyed state can drive either widget and a refresh that reorders the nodes keeps the reader's place. The cells of a row come from cells, called with the row's key in that state — a node path for the positional TreeState(), whatever TreeState.keyed extracts otherwise — so an application keeps its records in a Map by that key and looks them up, rather than smuggling them into node labels. It is called only for the rows on screen.

The header row is pinned; the body scrolls to keep the selection visible. Columns are laid out by the Layout solver from widths, and every cell is cut to its column through CharWidth, so a CJK or emoji cell never spills a half character into its neighbour. A row with fewer cells than columns leaves the rest blank; extra cells are ignored.

Type parameters

K

the state's key type

Value parameters

cells

the cells after the tree column, by row key

columnSpacing

blank columns between two columns

columns

the header titles; the first is the tree column's

headerStyle

the header row

highlightStyle

layered over the selected row, every column of it

nodes

the roots

style

the body rows

widths

one constraint per column, the tree column first; empty means equal shares

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait StatefulWidget[TreeState[K]]
class Object
trait Matchable
class Any
Show all
final case class Window(title: String, style: Style = ..., borderStyle: Style = ..., titleStyle: Style = ..., gripSymbol: String = ..., borderType: BorderType = ...) extends StatefulWidget[WindowState]

A floating window's frame: a bordered box with title on its top border — followed by · move or · resize while the keyboard arrange mode is on — and a ◢ resize grip in its bottom-right corner. The content goes in inner; where the window sits is the caller's business (WindowState.rect). The window is opaque: its whole area is cleared before the frame is drawn.

A floating window's frame: a bordered box with title on its top border — followed by · move or · resize while the keyboard arrange mode is on — and a ◢ resize grip in its bottom-right corner. The content goes in inner; where the window sits is the caller's business (WindowState.rect). The window is opaque: its whole area is cleared before the frame is drawn.

Stateless apart from the caller-owned WindowState; render-thread use only.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait StatefulWidget[WindowState]
class Object
trait Matchable
class Any
Show all
enum WindowMode

What the keyboard does to a Window: nothing (Normal), or — in the keyboard arrange mode — move it or resize it with the arrows.

What the keyboard does to a Window: nothing (Normal), or — in the keyboard arrange mode — move it or resize it with the arrows.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final class WindowStack

The caller-owned stacking order of a set of floating windows: the counter each WindowState.raise draws its z from. Keep one per set of windows — usually one per windowStack — in a field, and build its windows with window. Render-thread-only, like the windows themselves.

The caller-owned stacking order of a set of floating windows: the counter each WindowState.raise draws its z from. Keep one per set of windows — usually one per windowStack — in a field, and build its windows with window. Render-thread-only, like the windows themselves.

Attributes

Supertypes
class Object
trait Matchable
class Any
final class WindowState extends VersionedState

Caller-owned state of a floating Window: where it sits inside the area its stack is given (x, y from that area's top-left), how big it is, its stacking order z (larger draws on top), its arrange mode, and the press a pointer drag started from.

Caller-owned state of a floating Window: where it sits inside the area its stack is given (x, y from that area's top-left), how big it is, its stacking order z (larger draws on top), its arrange mode, and the press a pointer drag started from.

Built by WindowStack.window: raise draws from its stack's counter, so a window raised later sits above any window of the same stack raised earlier, and two stacks — two apps, two test suites in one JVM — never share one.

Render-thread-only and Versioned: explicit edits raise version, which is how a running app learns it owes a frame. Placement's settle records the rectangle already being painted without scheduling another frame.

Attributes

Companion
object
Supertypes
trait VersionedState
trait Versioned
class Object
trait Matchable
class Any
object WindowState

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
final case class Wizard(titles: Seq[String], current: Int, style: Style = ..., currentStyle: Style = ..., doneStyle: Style = ..., pendingStyle: Style = ..., separator: String = ..., doneSymbol: String = ..., currentSymbol: String = ..., pendingSymbol: String = ...) extends Widget, Measured

The progress header of a multi-step flow: ✓ Account ─ ● Profile ─ ○ Confirm — finished steps in doneStyle, the current one in currentStyle, the ones ahead in pendingStyle. When the row cannot hold every title it says Step 2 of 3 · Profile instead, clipped by display width.

The progress header of a multi-step flow: ✓ Account ─ ● Profile ─ ○ Confirm — finished steps in doneStyle, the current one in currentStyle, the ones ahead in pendingStyle. When the row cannot hold every title it says Step 2 of 3 · Profile instead, clipped by display width.

Stateless: current is read from the flow's WizardState by whoever builds it. Render-thread use only.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Measured
trait Widget
class Object
trait Matchable
class Any
Show all
object WizardState

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
final class WizardState(initialStep: Int = ...) extends VersionedState

Caller-owned state of a multi-step flow: the step on screen and the validation message the last refused Next left, if any. Moving in either direction clears the message.

Caller-owned state of a multi-step flow: the step on screen and the validation message the last refused Next left, if any. Moving in either direction clears the message.

Render-thread-only and Versioned: every mutation raises version, which is how a running app learns it owes a frame.

Attributes

Companion
object
Supertypes
trait VersionedState
trait Versioned
class Object
trait Matchable
class Any

Types

opaque type Borders

Which sides of a Block draw a border, packed into an Int bitset (same pattern as core Modifiers).

Which sides of a Block draw a border, packed into an Int bitset (same pattern as core Modifiers).

Attributes

type Language = Lexer

The lexer type under its 0.19 name. Language was a closed enum; it is now the open Lexer trait, and its four former cases are the Lexer values of the same names.

The lexer type under its 0.19 name. Language was a closed enum; it is now the open Lexer trait, and its four former cases are the Lexer values of the same names.

Attributes