OpenTUI 0.9.9

npmGitHub release

In earlier releases, a Rust app that changed its theme in an App::on_theme_mode handler kept the old theme’s selection colors on every widget it had already created. Widgets copied Theme::selection_bg and Theme::selection_fg when they were created, so App::set_theme reached only widgets created after the call. In 0.9.9 the default selection colors live in the native Context, and each selection reads them when it draws. Now App::set_theme recolors the selections of existing widgets too, including a selection that is on screen when you call it.

This also changes what None means in a widget’s selection_colors. Before, a None color kept the text color, and SelectionColors::default() inverted the selected cells. Now a None color takes the theme’s color, one color at a time. A selection inverts its cells only when neither the widget nor the theme sets a background. If your app used SelectionColors::default() to get inverted selections, those selections now draw in the theme’s colors.

C hosts set the same default with ot_context_set_selection_colors. Core apps see no change: selectionBg, selectionFg, and setSelectionColors work as before. The renderer now gives their colors to the native Context.

Added

  • native: ot_context_set_selection_colors sets the default selection background and foreground of a Context. A selection that has no color of its own uses the default, and a change also restyles current selections. See C. (#2198)

Changed

  • native: In the Rust crate, App::set_theme changes the selection colors of all widgets, including current selections. A color that selection_colors leaves None now takes the theme’s color, not the text color. See Widgets and layout. (#2198)

Fixed

  • core: MarkdownRenderable no longer throws undefined is not an object (evaluating 'c.ordinal=o++') while a list streams in. Lists now lay out after all blocks of an update are shown. OpenTUI 0.9.4 to 0.9.8 had this error. See Markdown. (#2199)
  • core: Apps in ConEmu draw with 24-bit color again, not with the 16-color palette. ConEmu dropped bytes after the startup queries, so it did not open its alternate screen. See Terminal capabilities. (#2200)
  • core: Mouse clicks work in ConEmu again. ConEmu sends every SGR mouse release as button 3, and such a release now releases the held button. See Interaction, focus, and selection. (#2200)

API changes#

@opentui/core#

Added

  • method FFIRenderLib.contextSetSelectionColors(context: NativeContextHandle, bg: RGBA | undefined, fg: RGBA | undefined): void

opentui.h#

Added

  • function ot_context_set_selection_colors(ot_context *, const uint16_t background[4], const uint16_t foreground[4]): ot_status