Migrate TUI from cursive to ratatui#3905
Open
iho wants to merge 3 commits into
Open
Conversation
Replaces the cursive/pancurses-backed TUI with ratatui + crossterm, which has no external C dependency (no more linking libncurses). This fixes cross-compilation failures, macOS crashes on mouse clicks, and Windows crashes on first run reported in mimblewimble#3841. The cursive retained-mode widget tree is replaced with a single App struct (src/bin/tui/app.rs) that every screen renders from each frame. All previous behavior (status fields, peer/mining table columns and formatting, bottom-anchored log view, keybindings, Controller's public API) is preserved, with a few additions: - Mouse support: click a menu item to switch tabs, scroll wheel moves table selection (safe now that ncurses is gone) - PageUp/PageDown/Home/End navigation in tables, with selection clamped to the table's row count - Redraws are throttled: the UI only repaints on input or new data, with a 250ms cap to keep time-based fields fresh Interactive column sorting (cursive_table_view) is dropped since ratatui's Table has no equivalent; tables render in the order ServerStats provides. Fixes mimblewimble#3841
ardocrat
reviewed
Jul 10, 2026
| @@ -0,0 +1,152 @@ | |||
| // Copyright 2024 The Grin Developers | |||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cursive/cursive_table_viewTUI (which pulls inpancurses/ncurses) withratatui+crossterm, which have no external C dependencyj/k/arrows,Tab,Enter,Esc,q, plusw/dto toggle the Mining sub-view) are preservedPageUp/PageDown/Home/Endnavigation in tables, and throttled redraws (repaint only on input or new data, 250ms cap) to reduce idle CPUcursive_table_view) is dropped, sinceratatui::widgets::Tablehas no equivalent — tables render in the orderServerStatsprovides. Can be revisited as a follow-up if wanted.Controller::new/Controller::run()'s public API (used bysrc/bin/cmd/server.rs) is unchangedKeyEventKind::Press, avoiding the classic doubled-keystroke issue with crossterm on WindowsTest plan
cargo build --bin grin— 0 errorscargo test --bin grin tui::status— bothupdate_sync_statusunit tests pass unmodifiedcargo clippy --bin grin— zero findings insrc/bin/tuiotool -Lthe built binary has noncurses/pancurseslinkageHome/End/PageUp/PageDown, mouse tab-clicks and wheel scrolling (via SGR escape injection) all verified; error-dialog path renders correctly;qexits cleanly with exit code 0 and the terminal fully restored (raw mode off, alternate screen left, mouse capture disabled)Fixes #3841