github anomalyco/opentui v0.9.5
Release v0.9.5

one hour ago

With conceal on, Markdown draws the box of a task item as ☐ or ☑. Before this release, an app could not get ASCII boxes and still conceal the rest of the document. Core apps had to patch the item's Text renderables, and Rust apps could not change the box at all. Now both bindings let you set the box text:

const markdown = new MarkdownRenderable(renderer, {
  content: "- [ ] write tests\n- [x] fix the bug",
  syntaxStyle,
  taskMarkers: { unchecked: "[ ]", checked: "[x]" },
})

In Rust, call task_markers("[ ]", "[x]") on a Markdown. The box is part of the item's marker. With [ ], the wrapped text of an item therefore continues at column 6, under its first word. When you change the option, the items already on screen update, also while the document streams. Without conceal, the option has no effect, and items show the source's [ ] or [x].

A Rust app that streams Markdown into the split-mode scrollback could already get the number of final top-level blocks from committed_block_count. It could not find which rows those blocks use. block_rows() now returns one Range<u32> for each top-level block in the latest frame. These are the same rows that ScrollbackSurface::commit_rows takes. Blocks are one row apart. To commit blocks from..to, each with the gap above it, start at rows[from - 1].end, or at rows[0].start for the first block, and end at rows[to - 1].end. Core apps read the same rows from the y and height of each child in MarkdownRenderable.getChildren(). A shared test checks that Core and Rust put the blocks of a streamed document on the same rows.

Starting with this release, the release workflow publishes the Rust crates to crates.io. cargo add anomalyco-opentui --rename opentui now gets the version of the newest release. Link the native archive from that same release. Prereleases are published too, but Cargo selects a prerelease only when you ask for one.

Added

  • core: MarkdownOptions.taskMarkers and MarkdownRenderable.taskMarkers set the text of the unchecked and checked task boxes when conceal is on. The defaults are ☐ and ☑. See Markdown. (#2173)
  • native: Rust Markdown::task_markers(unchecked, checked) sets the task boxes when conceal is on, as Core's taskMarkers does. See Code, Markdown, and highlighting. (#2173)
  • native: Rust Markdown::block_rows returns the rows of each top-level block in the latest frame, in the rows that ScrollbackSurface::commit_rows takes. See Time, animation, and the split footer. (#2174)
  • native: Each release publishes the Rust crates anomalyco-opentui-sys, anomalyco-opentui, and opentui-ssh to crates.io at the release version. See Install, link, and ship. (#2170)

API changes and documentation: https://opentui.com/docs/releases/0.9.5

What's Changed

Full Changelog: v0.9.4...v0.9.5

Don't miss a new opentui release

NewReleases is sending notifications on new releases.