github anomalyco/opentui v0.9.1
Release v0.9.1

one hour ago

createCliRenderer() returns before the terminal answers its startup queries, and an answer can change the width method. Up to 0.9.0, text created before that answer kept the startup guess. In tmux inside GNU Screen over ssh, a textarea put its cursor at cell 4 after 👍🏽 while the terminal drew the emoji in 2 cells, and selections and colors could land on other text.

In 0.9.1, a renderer whose width method changes measures the text in its scene again: Text, Code, Input, Textarea, TextTable, and Markdown tables. Cursors, selections, marks, colors, and undo points stay on their text. Applications that use these renderables need no changes.

A TextBuffer or EditBuffer that you create yourself keeps its width method. Pass true as the new third argument of create() to make it follow the renderer that shows it. Only one renderer at a time can show such a buffer. For a buffer that you draw outside a scene, call setWidthMethod() when the capabilities change:

import { CliRenderEvents, TextBuffer, createCliRenderer } from "@opentui/core"

const renderer = await createCliRenderer()
const widthMethod = renderer.capabilities?.unicode ?? "unicode"

const shown = TextBuffer.create(widthMethod, renderer.nativeScene, true)

const offscreen = TextBuffer.create(widthMethod, renderer.nativeScene)
renderer.on(CliRenderEvents.CAPABILITIES, (capabilities) => {
  if (capabilities) offscreen.setWidthMethod(capabilities.unicode)
})

Breaking changes

  • native: The reserved field of ot_edit_buffer_options is now flags. C code that names the field must rename it; code that zeroes the struct compiles unchanged. See C. (#2148)

Added

  • core: TextBuffer.create() and EditBuffer.create() take an optional followSessionWidth argument. A second renderer that shows a following buffer throws a NativeError with NativeStatus.WrongSession. See Editing buffers and views. (#2148)
  • core: TextBuffer.setWidthMethod() changes the width method of a buffer that you draw outside a scene, and TextBufferView.setSelectionColors() recolors the current selection without moving it. See Editing buffers and views. (#2148, #2149)
  • native: The C side of the same features: the OT_EDIT_BUFFER_FOLLOW_SESSION_WIDTH flag, ot_text_buffer_set_width_method, and the OT_SCENE_TEXT_SELECTION_COLORS operation. See C. (#2148, #2149)
  • native: link.exe can link opentui-static.lib into Windows MSVC executables, which also need ntdll, user32, bcrypt, and legacy_stdio_definitions. See C. (#2140)

Changed

  • native: The release archives and npm packages also ship LICENSE-ZIG, LICENSE-LLVM, LICENSE-MINGW-W64, LICENSE-GDTOA, and LICENSE-YOGA. See C. (#2140)

Fixed

  • core: Text, Code, Input, Textarea, TextTable, and Markdown tables created before the terminal replies now measure with the width method from the replies. See Text and terminal cells. (#2148, #2149)
  • native: In an auto-detected remote session, TMUX or a TERM that starts with tmux holds back the startup Kitty graphics query, which tmux showed as the pane title. See Terminal capabilities. (#2143)

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

What's Changed

  • native, rust: link OpenTUI statically into Windows MSVC executables by @simonklee in #2140
  • rust: pin which types may cross threads by @simonklee in #2144
  • rust: time keymap leaders on the app's clock by @simonklee in #2145
  • rust: wait on conditions instead of fixed sleeps in tests by @simonklee in #2147
  • rust: publish palettes without default colors, deny silent drops by @simonklee in #2146
  • native: detect tmux in auto-detected remote sessions by @Nowaker in #2143
  • native, core, rust: measure live text with the terminal's current width by @simonklee in #2148
  • native, core, rust: keep table cells at the terminal's width method by @simonklee in #2149

New Contributors

Full Changelog: v0.9.0...v0.9.1

Don't miss a new opentui release

NewReleases is sending notifications on new releases.