idet-core 0.1.0

Shared text-editing library for a Micro-like terminal editor and a gedit-like egui GUI
Documentation
  • Coverage
  • 100%
    29 out of 29 items documented0 out of 19 items with examples
  • Size
  • Source code size: 21.82 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 512.02 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 2s Average build duration of successful builds.
  • all releases: 4s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • porky11/idet
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • porky11

idet-core

Backend-agnostic editing logic for a text editor: word autocomplete, line moves, word swaps, indentation edits and bracket-pair matching. No dependencies, no I/O — every function takes a &str and a character index and returns a new string and cursor position (or a range). Drive it from a terminal UI, an egui widget, or anything else that owns the text buffer and the keybindings.

Built for idet, a Micro-like terminal editor, and its egui-based sibling idet-gui, sharing one editing core between two very different frontends.

Modules

  • completion — word collection and prefix/whole-word matching for autocomplete (collect_words, current_word, matches).
  • edits — insertion, indentation and newline-with-autoindent, plus line-start/line-end lookup (insert, newline_indent, indent_line, dedent_line, line_start_char, line_end_char).
  • lineops — moving the current line up or down, and translating between character offsets and line/column coordinates (move_line, line_column, cursor_at).
  • wordops — swapping the word at the cursor with an adjacent word (swap).
  • brackets — finding the matching bracket for (), [] or {} at or near the cursor (find_matching_bracket).

Design

Every operation is a pure function over character indices, not byte offsets — callers don't need to think about UTF-8 boundaries. Multi-cursor editing is the caller's responsibility: run the same operation once per cursor, in descending position order, shifting later cursors by the delta each edit produces.