Structural editor implemented in Rust

  1. Please note:
    I am NOT asking about structural editor FOR rust.
    I am asking about structural editor IMPLEMENTED in Rust.

  2. By "structural editor" I am referring to Structure editor - Wikipedia -- for example: Paredit, TexMacs/LyX, MS Word, WYSIWYG HTML Editors

  3. I need to implement a mini-structural editor in Rust.

  4. Is there any good example of structural editors implemented in Rust? I'm looking to understand the basic algorithms / structs / layouts / techniques used.

  5. The "document" is guaranteed to be "tree shaped"

I haven't done one yet, but I plan to. Some ideas: Curses-like interface will be easiest. You'll need to decide which elements are vertical (take vertical space and don't overlap with over vertical elements) and which are horizontal (take horizontal space and will be wrapped). You may need to cache sizes of vertical elements to aid in scrolling quickly. Open/close flags can go in the same cache. Somehow you'll need a way to link across to the data tree from the cache. Maybe run with a modified data tree just for the editor (e.g. the in-memory data tree could be ordered whereas the underlying data storage is unordered). Then probably simplest (for curses) to just render the whole of a vertical element (including any horizontal sub-elements) directly from the data tree each time an update within it is required. Then decide how you're going to represent the cursor and incomplete elements (e.g. if an incomplete element is invalid by the tree grammar, you'll need to find a way to express tree elements which are partial, and render them). This is the kind of fun project I'm looking forward to doing in Rust if/when I have some time.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.