stefnotch / aftermath-editor

A WYSIWYG mathematics editor that understands your formulas!
https://stefnotch.github.io/aftermath-editor
MIT License
13 stars 0 forks source link

Combine moving and deleting code #72

Open stefnotch opened 9 months ago

stefnotch commented 9 months ago

delete:

  1. note down caret |
  2. find target (according to move mode and direction) char: next character (symbol node or empty container node) word: according to token on current line, until end of token line: until end of line
  3. if target found, then select and delete target (range deletion)
  4. if no target found, go through all the special cases (like lowering a superscript or just moving into a fraction)

moving works roughly the same, except that we don't delete stuff. 4 is also the special moving case

Notice how we'll have to change both the moving and deleting case.