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_colorssets 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_themechanges the selection colors of all widgets, including current selections. A color thatselection_colorsleavesNonenow takes the theme's color, not the text color. See Widgets and layout. (#2198)
Fixed
- core:
MarkdownRenderableno longer throwsundefined 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 and documentation: https://opentui.com/docs/releases/0.9.9
What's Changed
- native: one default selection color for Core and Rust by @simonklee in #2198
- core: lay out Markdown lists once every changed block shows by @simonklee in #2199
- native: fix 16-color drawing and lost mouse clicks in ConEmu by @simonklee in #2200
Full Changelog: v0.9.8...v0.9.9