lapce_editor_core 0.1.1 copy "lapce_editor_core: ^0.1.1" to clipboard
lapce_editor_core: ^0.1.1 copied to clipboard

Pure-Dart text editing engine ported from Lapce/Floem editor-core.

lapce_editor_core #

Pure-Dart editing engine ported from the editor core used by Lapce/Floem. It contains no Flutter dependency and provides:

  • a persistent rope with UTF-16 public offsets and UTF-8 conversion;
  • grapheme-, word-, paragraph-, and modal movement;
  • selections, cursors, transactions, delta maps, and grouped undo/redo;
  • edit, motion-mode, multi-selection, register, clipboard, indentation, and line-ending behavior.
import 'package:lapce_editor_core/lapce_editor_core.dart';

final buffer = Buffer('hello');
final cursor = Cursor.origin(modal: false);

Action.insert(cursor, buffer, 'Hi ');
final text = buffer.text.text();

TextOffset is measured in UTF-16 code units so offsets can be passed directly to Flutter text APIs. Movement methods snap to extended grapheme boundaries; use the line-local conversion methods on RopeTextBuffer when an integration requires UTF-8 byte offsets.

All edits should go through Buffer.edit, Buffer.applyTransaction, or the Action dispatcher. The returned DeltaMap transforms selections, decorations, and host-owned anchors from the pre-edit to post-edit document.

0
likes
130
points
152
downloads

Documentation

API reference

Publisher

verified publishermeshagent.com

Weekly Downloads

Pure-Dart text editing engine ported from Lapce/Floem editor-core.

Repository (GitHub)
View/report issues

License

Apache-2.0 (license)

Dependencies

characters

More

Packages that depend on lapce_editor_core