mirror of
https://github.com/anomalyco/opentui.git
synced 2026-04-24 20:45:56 +03:00
[PR #746] [CLOSED] Add Rust native core implementation with C ABI FFI bindings #753
Labels
No labels
bug
core
documentation
feature
good first issue
help wanted
pull-request
question
react
solid
tmux
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/opentui#753
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/anomalyco/opentui/pull/746
Author: @bgub
Created: 2/27/2026
Status: ❌ Closed
Base:
main← Head:claude/zig-to-rust-deno-XSmm4📝 Commits (1)
c8a734cRewrite native core from Zig to Rust with Deno FFI support📊 Changes
24 files changed (+6405 additions, -0 deletions)
View changed files
📝
packages/core/package.json(+3 -0)➕
packages/core/src/rust/.gitignore(+2 -0)➕
packages/core/src/rust/Cargo.lock(+23 -0)➕
packages/core/src/rust/Cargo.toml(+20 -0)➕
packages/core/src/rust/build.sh(+120 -0)➕
packages/core/src/rust/deno_ffi.ts(+141 -0)➕
packages/core/src/rust/src/ansi.rs(+148 -0)➕
packages/core/src/rust/src/buffer.rs(+710 -0)➕
packages/core/src/rust/src/edit_buffer.rs(+501 -0)➕
packages/core/src/rust/src/editor_view.rs(+248 -0)➕
packages/core/src/rust/src/event_bus.rs(+21 -0)➕
packages/core/src/rust/src/ffi.rs(+1621 -0)➕
packages/core/src/rust/src/grapheme.rs(+220 -0)➕
packages/core/src/rust/src/lib.rs(+24 -0)➕
packages/core/src/rust/src/link.rs(+110 -0)➕
packages/core/src/rust/src/logger.rs(+37 -0)➕
packages/core/src/rust/src/renderer.rs(+532 -0)➕
packages/core/src/rust/src/rope.rs(+314 -0)➕
packages/core/src/rust/src/syntax_style.rs(+113 -0)➕
packages/core/src/rust/src/terminal.rs(+384 -0)...and 4 more files
📄 Description
Summary
This PR introduces a complete Rust implementation of the OpenTUI native core, replacing the Zig backend while maintaining full C ABI compatibility with the existing TypeScript FFI bindings. The implementation provides a high-performance terminal UI library with double-buffered rendering, text editing, and advanced terminal capabilities.
Key Changes
Core FFI Module (
ffi.rs): Comprehensive C ABI exports matching the original Ziglib.ziginterface, enabling seamless integration with Deno viaDeno.dlopen()without modifying existing TypeScript bindingsRenderer System (
renderer.rs): Double-buffered terminal renderer with hit grid support for mouse event dispatch, render statistics tracking, and debug overlay capabilitiesText Editing (
edit_buffer.rs,text_buffer.rs,rope.rs): Full-featured text editing with:Text Display (
text_buffer_view.rs,editor_view.rs): Viewport-based text rendering with:Buffer Management (
buffer.rs): Structure-of-arrays optimized buffer layout for cache-friendly rendering with scissor rect and opacity stack supportTerminal Abstraction (
terminal.rs): Terminal capability detection and control including:Supporting Infrastructure:
utf8.rs: UTF-8 handling with multiple width calculation methodsgrapheme.rs: Grapheme cluster pooling for multi-byte charactersansi.rs: ANSI escape sequence constantslink.rs: Hyperlink URL poolingsyntax_style.rs: Syntax highlighting style registrylogger.rs,event_bus.rs: Callback-based logging and event dispatchutils.rs: Color blending and utility functionsBuild System (
Cargo.toml,build.sh):Deno Integration (
deno_ffi.ts): TypeScript FFI bindings for loading and using the compiled native library with DenoPackage Configuration: Added
build:rustnpm script for building the Rust native coreNotable Implementation Details
#[no_mangle] pub unsafe extern "C"to maintain symbol table compatibility with existing TypeScript bindingshttps://claude.ai/code/session_01YTxVJjcA1ZQzz7t26u62iJ
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.