suchnsuch / Tangent

The publicly-available modules of the Tangent project.
141 stars 8 forks source link

Invoking Text Composition is failing when done at the end of a line, breaking the editor #60

Closed taylorhadden closed 6 months ago

taylorhadden commented 6 months ago

Repro:

  1. Create a new note. Add some text, and then some text on a second line.
  2. At the very end of the first line, type ´ (e.g. option+e on a Mac english keyboard). We would expect the character to be typed and then to be able to add an additional character that the accent would be applied to.
  3. The editor "eats" the character, shifting the cursor forward, and subsequent inputs continue to shift the cursor.

The editor is clearly going into a bad state due to being unable to handle whatever special mode the accent application system is using.

taylorhadden commented 6 months ago

This is being caused because the change in selection is being detected by the editor, triggering a re-render. I'm not sure what's special about the end of the line vs the middle of the line (where it mostly seems to work).

Fix coming in soon.

taylorhadden commented 6 months ago

Pretty sure the root cause was that the selection change was causing material HTML changes (the "line focus" class needed to be updated). That wasn't happening in the middle of the line, so things were playing as okay.