Skip to content
CAI
Software that uses CAICheck a score

gyscos/cursive

71.7

Strong · 30 September 2026

33.6k

lines of production code

Rust

primary language

2

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a Rust-based terminal user interface (TUI) library that provides a comprehensive framework for building interactive console applications. It features a modular architecture with a core rendering engine, a flexible view system for managing UI components, and advanced styling capabilities including gradients and syntax highlighting. The library supports multiple terminal backends and allows for declarative UI construction via configuration files and procedural macros.

How it got here

2015–2020 — Core architecture and backend refactoring

17 changes.

This period focused on restructuring the Cursive codebase into a multi-crate workspace, introducing cursive-core as the foundational TUI library with a new view system and layout engine. Significant work was done to improve text rendering, styling, and backend initialization, while removing initial prototype scaffolding to establish a stable, modular architecture.

2022–2026 — Style system overhaul and builder macros

9 changes.

This period focused on significantly expanding the core styling system with granular color types, effects, and gradient support, while introducing a new \cursive-syntect\ crate for syntax highlighting. Concurrently, the \cursive-macros\ crate added builder and blueprint macros to enable configuration-driven UI construction, gated behind an optional feature to optimize build times.

Features

Add cursive-syntect library for syntect-based text highlighting

A new \cursive-syntect\ crate has been added to provide syntax highlighting capabilities by integrating the \syntect\ library with the Cursive core styling system. This module exposes a \parse\ function that takes input text, a \syntect\ highlighter, and a syntax set to produce a \StyledString\ with applied formatting. It includes helper functions to translate \syntect\ font styles (bold, italic, underline) and colors into the corresponding Cursive \style::Effects\ and \style::Color\ types, enabling users to render highlighted code or text within Cursive applications.

cursive-syntect/src · high confidence

Add syntect syntax highlighting example

The repository now includes a new example application (\parse.rs\) that demonstrates how to integrate the \cursive-syntect\ library for syntax-highlighted text rendering within a Cursive TUI. This example loads default syntax sets and themes, allows users to switch between available themes via a dialog (triggered by pressing 'T'), and applies the selected theme's colors to the Cursive UI palette while highlighting Rust source code.

cursive-syntect/examples · high confidence

Introduction of Resolvable trait for configuration-driven type resolution

A new \Resolvable\ trait has been added to the builder module, enabling types to be constructed from configuration sources (such as YAML) or stored context variables. This change introduces a mechanism for resolving values like colors, alignments, and gradients directly from config files, allowing users to define UI styles and view properties declaratively rather than hardcoding them in Rust code.

cursive-core/src/builder · high confidence

Introduction of blueprint and callback\_helpers macros

The cursive-macros crate now exposes two new procedural macros: \blueprint\, which generates view creation logic from configuration, and \callback\_helpers\, which simplifies the handling of callback types by automatically wrapping and unwrapping trait objects to ensure type safety during downcasting.

cursive-macros/src · high confidence

Introduction of cursive-core as the foundational TUI library

The \cursive-core\ crate has been introduced to provide the core components for the Cursive TUI, serving as the base for third-party libraries and the main \cursive\ application. This new module defines the essential architecture, including the \Backend\ trait for terminal interaction, a \PrintBuffer\ for efficient screen rendering, and the \Cursive\ root struct for managing the view tree and event loop. It also introduces a \Builder\ system for constructing views from configuration objects, a \Logger\ for capturing log records in a debug view, and comprehensive support for alignment, direction, and styling. This separation establishes a clear boundary between the core rendering engine and higher-level application logic.

cursive-core/src · high confidence

Introduction of cursive-core with new foundational views

The library now includes a new \cursive-core\ crate containing the foundational view implementations. This location introduces core UI components such as \Button\, \Dialog\, \EditView\, \Checkbox\, and \Canvas\, along with layout and wrapper views like \FixedLayout\, \CircularFocus\, \EnableableView\, and \HideableView\. These views provide the basic building blocks for constructing terminal user interfaces, including support for styled text, focus management, and event handling.

cursive-core/src/views · high confidence

Introduction of new gradient styling system

A new module for defining and rendering gradients has been added to the style system. This introduces support for linear, angled, radial, and bilinear gradients, allowing users to apply complex color transitions to UI elements. The implementation includes a new \Rgb\<f32\>\ color representation with a \[0, 1\] range and provides various preset gradients like rainbow and black-to-white.

cursive-core/src/style/gradient · high confidence

New and updated examples for Cursive

The examples directory has been reorganized and expanded with new demonstrations for key features. New examples include \ansi\ for parsing ANSI-decorated text, \builder\ for template-driven view construction using YAML blueprints, \gradient\ for applying linear, radial, and angled gradients to views, and \checkbox\ variants showing both manual and \MultiChoiceGroup\-based selection. Existing examples have been updated to reflect API changes, such as the \menubar\_styles\ example now rendering \StyledString\ in labels, and the \colored\_text\ example highlighting Crossterm's raw ANSI output limitations.

cursive/examples · high confidence

New markup parsing capabilities for ANSI, Markdown, and gradients

The \cursive-core\ markup module now supports parsing ANSI escape codes (behind the \ansi\ feature), Markdown text (behind the \markdown\ feature), and applying linear color gradients to styled strings. Users can render terminal-colored text, format Markdown content into styled spans, and apply gradient effects to text backgrounds or foregrounds, in addition to the existing cursup markup parser.

cursive-core/src/utils/markup · high confidence

New view system foundation with layout keys and finder traits

The \cursive-core/src/view\ module introduces the core infrastructure for the new view system. It adds the \Finder\ trait and \Selector\ enum, enabling users to locate and interact with specific views in the tree via \call\_on\ and \find\_name\. Layout behavior is improved with \View::layout\_key\ and the \layout\_key\ module, which allow containers to cache and reuse size computations efficiently. Helper traits like \Resizable\, \Scrollable\, and \Nameable\ provide builder-style methods to wrap views in \ResizedView\, \ScrollView\, and \NamedView\ respectively. The module also includes \Margins\ for spacing, \Position\ and \Offset\ for view placement, and \AnyView\ for safe downcasting of view types.

cursive-core/src/view · high confidence

Removals

Removed initial TUI scaffolding and example code

The initial prototype files for the TUI framework have been removed from the source tree. This includes the \src/example.rs\ and \src/main.rs\ files that demonstrated a basic Hello World dialog, as well as the core implementation files \src/lib.rs\, \src/view.rs\, and \src/focus.rs\. These deletions remove the original \Cursive\ struct, the \View\ trait, and basic UI components like \TextView\, \Button\, and \Dialog\ that were part of the first commit, indicating a significant refactoring or cleanup of the initial codebase.

src · high confidence

Architecture

Refactored scrolling logic into a reusable core module

The scrolling implementation has been restructured into a new \cursive-core/src/view/scroll\ module, introducing a \Core\ struct to manage scroll state (offset, size, strategy) and a \Scroller\ trait to allow any view to embed this logic. This change extracts the low-level layout, event handling, and drawing routines into helper functions (\raw\ module) and public API functions (\mod.rs\), separating the scroll mechanics from specific view implementations. Users can now implement scrolling for custom views by embedding \scroll::Core\ and implementing the \Scroller\ trait, leveraging the provided \on\_event\, \layout\, and \draw\ helpers.

cursive-core/src/view/scroll · high confidence

Behavioural changes

Builder macros are now an optional feature

The builder macros (blueprint and callback helpers) are now gated behind the \builder\ feature flag. When the feature is disabled, the macros become no-ops or pass-throughs, reducing compile time and binary size for users who do not use the builder pattern. This change also includes a rename of the internal 'recipe' concept to 'blueprint' and updates the \syn\ dependency to version 3.

cursive-macros/src/builder · high confidence

Curses backend refactoring and feature additions

The curses backend implementation has been reorganized into the \cursive/src/backends/curses\ directory, splitting logic into \n.rs\ (ncurses) and \pan.rs\ (pancurses). This change introduces new initialization methods (\init\_stdio\) for both backends, allowing them to use stdin/stdout instead of hardcoding \/dev/tty\. It also adds support for \Effect::Dim\ and \Effect::Blink\ visual styles, implements \Backend::set\_title\ for setting terminal titles, and fixes wheel-down event handling on legacy pancurses. Additionally, the backend now assumes a minimum of 8 colors and uses \libc::setlocale\ for proper locale handling.

cursive/src/backends/curses · high confidence

Minesweeper example now prevents losing on the first click

The Minesweeper example has been refactored into a modular board structure (model and view) and now ensures that bombs are only placed after the player's first move. This guarantees that the initial click and its immediate neighbors are always safe, preventing an unavoidable loss on the very first action.

cursive/examples/mines/board · high confidence

Minesweeper example relocated to cursive/examples/mines

The Minesweeper example application has been moved from the repository root into the cursive/examples/mines directory. This change reorganizes the project structure to better align with the library's layout, ensuring the example is found in its expected location alongside other cursive-specific samples.

cursive/examples/mines · high confidence

New backend initialization API with CursiveExt and CursiveRunnable

The library introduces a new way to initialize and run Cursive applications via the \CursiveExt\ trait and \CursiveRunnable\ struct. Users can now use \Cursive::new()\ followed by \run()\ to automatically select an available backend (prioritizing BearLibTerminal, Termion, Crossterm, Pancurses, Ncurses, or falling back to Dummy), or explicitly choose a backend using methods like \run\_crossterm()\, \run\_ncurses()\, etc. Alternatively, \CursiveRunnable\ allows creating a Cursive instance with a specific backend bound at construction time, supporting both immediate running via \.run()\ and manual event loop control via \.runner()\. This simplifies setup by decoupling backend selection from the initial \Cursive\ creation.

cursive/src · high confidence

New span-aware text layout engine for line wrapping

The text layout logic in \cursive-core\ has been replaced with a new \spans\ module that correctly handles line wrapping for styled text. This change ensures that text wrapping respects multiple style spans (e.g., bold or italic segments) and accurately calculates line widths, fixing issues where text alignment and wrapping were incorrect. It also improves handling of edge cases such as control characters, newlines, and wide characters that exceed the available width.

cursive-core/src/utils/lines/spans · high confidence

Puppet backend refactoring and cursor tracking

The Puppet backend has been reorganized under the new \cursive/src/backends/puppet\ path and updated to use \Arc\ instead of \Rc\ for shared style references, improving thread-safety characteristics. A new cursor position is now tracked internally, splitting the previous \print\_at\ method into \move\_to\ and \print\ operations to allow independent cursor movement and text rendering. Additionally, the \ObservedScreen\ type now implements \Display\ for formatted output, and static values have been migrated from \lazy\_static\ to standard \std::sync::LazyLock\.

cursive/src/backends/puppet · high confidence

Rearranged backend module structure and added \`try\_default\` initialization

The backend implementations (Termion, Crossterm, BearLibTerminal, etc.) have been moved from \src/backend/\ into the new \cursive/src/backends/\ module. A new \try\_default()\ function is now available to automatically initialize the first enabled backend from the configured list (BearLibTerminal, Termion, Crossterm, Pancurses, Ncurses, or Dummy). Additionally, the resize thread now gracefully stops if sending a resize signal fails, and the BearLibTerminal backend now supports setting the terminal title.

cursive/src/backends · high confidence

Refactored callback macros and enhanced styled string utilities in cursive-core

The \cursive-core\ utility module has been restructured, moving files like \counter.rs\, \immutify.rs\, and \span.rs\ into the core crate. The \immut1!\, \immut2!\, and \immut3!\ macros now use \std::sync::Mutex\ instead of \RefCell\ for thread safety and support an optional \else\ branch for handling lock contention. A new \once1!\ macro was added to wrap \FnOnce\ closures into \FnMut\ callbacks that execute only once. Additionally, \SpannedString\ and \SpannedStr\ gained new capabilities including \FromIterator\ implementation, \const\ constructors, double-ended iterators, and methods for canonicalization (\canonicalize\, \canonical\) and simplification of styled text spans.

cursive-core/src/utils · high confidence

Restructured and expanded the style system with new color and effect types

The \cursive-core/src/style\ module has been significantly reorganized and expanded to provide a more granular and flexible styling system. This change introduces new types for managing visual appearance, including \BorderStyle\ for dialog and panel borders, \BaseColor\ and \Rgb\ for precise color definitions (with \Rgb\<f32\>\ now using a 0-1 range), and \Effect\/\Effects\ for text attributes like bold, italic, and underline. The \Palette\ system has been enhanced to support custom color namespaces and styles, while \ColorStyle\ and \Style\ types now offer more robust inheritance and resolution logic. These changes allow for more detailed theming and consistent visual styling across the application.

cursive-core/src/style · high confidence

Text rows now track wrap status

The \Row\ struct in the simple lines utility now includes an \is\_wrapped\ boolean field, allowing consumers to distinguish between text that was naturally broken by line length versus text that was wrapped due to truncation or other constraints. This change supports the fix for text alignment issues when wrapping (issue \#471) by providing explicit metadata about how each row was generated.

cursive-core/src/utils/lines/simple · high confidence

Test coverage

Added rendering tests for ProgressBar

Added automated tests for the ProgressBar component to verify its visual layout and text rendering at 0%, 50%, and 100% values using the puppet backend.

cursive/tests · high confidence

Dependencies

Workspace restructure to Rust 2024 edition and resolver 3

The project has been restructured into a multi-crate workspace containing \cursive\, \cursive-core\, \cursive-syntect\, and \cursive-macros\. All crates now target the Rust 2024 edition and use resolver version 3. This update includes significant dependency upgrades, such as \syn\ to version 3, \compact\_str\ to 0.10, \enumset\ to 1.1.4, \crossterm\ to 0.29, and \unicode-width\ to 0.2, alongside the introduction of new optional features like \ansi\ and \toml\ parsing in the core library.

(dependencies) · high confidence

Housekeeping

Initial repository setup and documentation

The repository is initialized with standard project documentation and configuration files, including a CHANGELOG, CODE\_OF\_CONDUCT, CONTRIBUTING guide, and MIT LICENSE. The README provides usage instructions and showcases, while developer tooling is configured via rustfmt.toml, rust-analyzer.json, and a Nix shell environment (shell.nix). Examples are linked via a symlink, and build artifacts are excluded in .gitignore.

(repo-wide) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 74 → 72 (-1.9)
  • Rubric changed (rubric-2026.09.11 → rubric-2026.09.18) — scores are not directly comparable.

Lenses

  • Code Health 89 → 89 (+0.2)
  • Architecture 100 → 95 (-4.7)
  • Maturity 62 → 62 (+0.3)
  • Readiness 74 → 70 (-4.8)
  • Security 92 → 92 (+0.0)

Resolved (6)

  • Duplicated block (6 lines × 2) (cursive-core/src/views/text_area.rs)
  • Hotspot: cursive-core/src/view/scroll/raw.rs (cursive-core/src/view/scroll/raw.rs)
  • Hotspot: cursive-core/src/views/menubar.rs (cursive-core/src/views/menubar.rs)
  • Hotspot: cursive-core/src/views/text_area.rs (cursive-core/src/views/text_area.rs)
  • Hotspot: cursive/src/backends/curses/pan.rs (cursive/src/backends/curses/pan.rs)
  • TodoComment (cursive-core/src/views/text_area.rs)

New (14)

  • Ambiguous naming for similar operations. set_global_callback and add_global_callback likely perform the same action (registering a callback), but the distinction between 'set' (replace?) and 'add' (append?) is unclear without documentation. If they do the same thing, they are redundant.
  • Dependency hygiene PARTLY measured — Cargo dependencies read, no committed lock to grade for currency
  • Inconsistent initialization method naming and signatures across backend implementations. crossterm uses init and init_with_stdout_file, while curses.n and termion use init, init_stdio, and init_with_files. The parameter types also vary (str vs File).
  • Inconsistent return types for run methods. run_ncurses, run_pancurses, run_termion, and run_crossterm return Result, while run_blt and run return Box (or similar non-Result type). This forces callers to handle errors differently depending on the backend.
  • Low cohesion: Backend (LCOM4 6) (cursive/src/backends/curses/n.rs)
  • Low cohesion: Backend (LCOM4 7) (cursive/src/backends/blt.rs)
  • Low cohesion: Checkbox (LCOM4 4) (cursive-core/src/views/checkbox.rs)
  • Low cohesion: Printer (LCOM4 8) (cursive-core/src/printer.rs)
  • Low cohesion: ScrollView (LCOM4 4) (cursive-core/src/views/scroll_view.rs)
  • Low cohesion: XY (LCOM4 4) (cursive-core/src/xy.rs)
  • Presence of 'inner' suffixed methods suggests internal implementation details are exposed publicly. set_on_pre_event and set_on_event_inner likely serve similar purposes but with different internal handling or visibility, which is confusing for API users.
  • Projects may be oversized for their cohesion
  • Redundant factory methods on CursiveRunnable that duplicate the functionality of the top-level cursive module functions (cursive.ncurses(), etc.). This creates two parallel ways to create runnable instances for the same backend.
  • TextArea::edit (cognitive 16) (cursive-core/src/views/text_area.rs)

Changes since last survey

  • 21 commits — 19 feature/other, 2 fixes

By area

  • cursive-core/src — 20 commits
  • (root) — 1 commit

Notable commits

  • fix: Layout keys for all builtin views; fix ScrollView's size cache
  • fix: TextArea: fix edits and required_size
  • change: Add View::layout_key and validate LinearLayout caches with it
  • change: Cache TextView sizes per width
  • change: Clear Panel's invalidated flag on layout
  • change: Don't draw children that aren't visible
  • change: Explain why LinearLayout only reuses exact requests
  • change: Guarantee the printer uses an output window within the buffer bounds
  • change: LinearLayout: cap minimums at ideal sizes, reuse by how sizes were computed
  • change: LinearLayout: compute its layout key once per layout pass
  • change: LinearLayout: measure children at their minimum length when giving up
  • change: LinearLayout: only reuse sizes for the exact same request
  • change: LinesIterator: don't count line breaks in chunk widths
  • change: LinesIterator: leave out what can't fit, instead of stopping
  • change: Memoize LinearLayout sizes within a layout pass
  • change: Reuse LinearLayout sizes for requests that still hold them
  • change: ScrollBase: don't divide by zero or underflow when nothing scrolls
  • change: Test containers against erratic children, and cache bounds
  • change: TextView: don't update the snapshot when answering for width 0
  • change: TextView: need a column and at most one row per byte at width 0
  • …and 1 more

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

gyscos/cursive was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 30 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 9250e09c00b0c94b216178d07e45bd79b317dcec — the exact code this score is about.
  • Scored under rubric-2026.09.18 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-cb25ca4feafa.