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.

Libraries

lapce_editor_core