Skip to main content

Module editor

Module editor 

Source
Expand description

Core text editing operations on top of Rope + CursorNavigator.

Editor combines a Rope with a CursorPosition and provides the standard editing operations (insert, delete, cursor movement) that power TextArea and other editing widgets.

§Example

use ftui_text::editor::Editor;

let mut ed = Editor::new();
ed.insert_text("hello");
ed.insert_char(' ');
ed.insert_text("world");
assert_eq!(ed.text(), "hello world");

// Move cursor and delete
ed.move_left();
ed.move_left();
ed.move_left();
ed.move_left();
ed.move_left();
ed.delete_backward(); // deletes the space
assert_eq!(ed.text(), "helloworld");

Structs§

Editor
Core text editor combining Rope storage with cursor management.
Selection
Selection defined by anchor (fixed) and head (moving with cursor).