tawasuyu

tawasuyu/llimphi

Sovereign retained-mode GPU UI framework in Rust (wgpu+vello+taffy+parley), Elm loop, 40+ widgets.

Rust 229TOML 101Markdown 82Shell 24052 Definiciones

⎇ main widgets/text-editor-core/src/lib.rs Rust · 58 líneas · 2.5 KB Historia Quién tocó qué crudo

chore: refresco desde el monorepo (pin tawasuyu.git v0.3.0) b575c63f1 · Sergio ·

1//! `llimphi-widget-text-editor-core` — núcleo agnóstico del editor de código.
2//!
3//! Capas finas y **puras** (sin IO, sin Llimphi, sin GPU) sobre [`ropey`]:
4//!
5//! - [`buffer`] — wrapper de `Rope` con conversiones (línea, col) ↔ char_offset.
6//! - [`cursor`] — `Cursor` + `Selection`; movimiento por char/word/line/page.
7//! - [`ops`] — operaciones puras de edición sobre `(Buffer, Cursor) → (Buffer, Cursor)`.
8//! - [`undo`] — pila reversible: cada operación se registra como `EditDelta`.
9//! - [`bracket`] — matching de paréntesis/llaves/corchetes.
10//! - [`find`] — búsqueda incremental sobre el buffer.
11//! - [`diagnostics`] — modelo de diagnósticos (errores/warnings) por rango.
12//! - [`clipboard`] — abstracción de portapapeles (mem/null) sin tocar el SO.
13//! - [`highlight`] — syntax highlighting: tree-sitter (Rust/Python), WAT.
14//! - [`sintaxis`] — el resto de los lenguajes, tokenizados en Rust puro
15//!   (JS/TS, Go, C/C++, Java, Ruby, shell, SQL, JSON, TOML, YAML, Markdown,
16//!   HTML, CSS, diff…) — sin gramáticas C ni toolchain por lenguaje.
17//!
18//! Único acoplamiento externo: [`peniko::Color`] en [`highlight::SyntaxPalette`]
19//! — un tipo de color, no el stack de render. Eso deja el núcleo reutilizable
20//! desde un TUI, una mini-REPL, un text-input single-line, un backend web, etc.
21//! La capa visual (state + view sobre Llimphi) vive en
22//! `llimphi-widget-text-editor`, que re-exporta todo este núcleo.
23//!
24//! ## `no_std`
25//!
26//! El crate es `no_std` + alloc por estructura (W7+ de
27//! `03_ukupacha/wawa/PLAN-LLIMPHI.md`: el editor entra a la jaula WASM).
28//! Las features `ropey` y `treesitter` (default-on) lo vuelven std; sin
29//! ellas el buffer usa la soga propia y el highlight degrada Rust/Python
30//! a `Plain` — la API no cambia.
31
32#![cfg_attr(not(any(feature = "std", test)), no_std)]
33#![forbid(unsafe_code)]
34
35extern crate alloc;
36
37pub mod bracket;
38pub mod buffer;
39pub mod clipboard;
40pub mod cursor;
41pub mod diagnostics;
42pub mod find;
43pub mod highlight;
44pub mod ops;
45pub mod plegado;
46pub mod sintaxis;
47pub mod tsedit;
48pub mod undo;
49
50pub use buffer::Buffer;
51pub use tsedit::{InputEdit, Point};
52pub use clipboard::{Clipboard, MemClipboard, NullClipboard};
53pub use cursor::{Cursor, Pos, Selection};
54pub use diagnostics::{Diagnostic, DiagnosticRange, Severity};
55pub use find::{all_matches, find_next, find_prev, FindState};
56pub use highlight::{Highlighter, Language, Span, SyntaxPalette, TokenKind};
57pub use ops::{indent_str, EditDelta};
58pub use undo::UndoStack;