I'm giving up finding a more generalized solution. The issue is that we
need the correct selection state right up to the point where we modify
Lines, in order to capture precise undo state.
Hopefully there aren't any other keychords that should clear the
selection.
We just need to ensure textinput events never make use of selection
state.
All tests are passing, but I'm aware of a couple of issues. But now we
can keep all the special cases in one place.
Now all the cases that clear Selection1 do so in a very consistent way
at the end of each case. And cases that set Selection1 symmetrically do
so at the start of each case.
Bugfix: we want selections to persist even when we lift up the shift
key.
This requires hoisting some code inside every case inside the whole
keypress hierarchy, to ensure we never clear selections before
textinput events can handle them.
Current cross-cutting concerns we're explicitly scattering code for.
- autosave
- undo
- selection management
To reproduce:
click to position cursor at end of a line
hit enter
press any key
before:
newline got erased and key got added to previous line
now:
newline is preserved
The new test checks a generalization of this.
It's important that the error be additive rather than multiplicative,
otherwise the area grows asymmetrically along a line.
Hopefully freehand drawings will work more intuitively now.
It might reduce wear and tear on disk, and losing 3 seconds of data
doesn't feel catastrophic (short of a C-z rampage).
Thanks to the love2d.org community for the suggestion:
https://love2d.org/forums/viewtopic.php?f=14&t=93173
It was kinda weird that we were recording the start but not the end.
And moving the start point didn't actually affect the arc.
Let's see if we actually ever need it.