Commit Graph

107 Commits

Author SHA1 Message Date
Kartik K. Agaram b69801bdf1 highlight selection while dragging
Mouse stuff is pretty strenuous. For the first time I have to be careful
not to recompute too often. And I ran into a race condition for the
first time where resetting line.y within App.draw meant mouse clicks
were extremely unlikely to see line.y set.
2022-06-03 13:22:03 -07:00
Kartik K. Agaram 73cc12047e select text using mouse drag
Doesn't yet highlight while dragging.
2022-06-03 08:11:18 -07:00
Kartik K. Agaram 7301f3964c up arrow to search previous 2022-06-03 07:48:41 -07:00
Kartik K. Agaram 8047ab9b89 switch copy/paste to ctrl- hotkeys 2022-06-02 23:52:26 -07:00
Kartik K. Agaram dcdcd07902 switch undo/redo to ctrl- hotkeys 2022-06-02 23:48:35 -07:00
Kartik K. Agaram 0b63721bb0 extract a new variable 2022-06-02 23:40:20 -07:00
Kartik K. Agaram 9bbfc2be13 crisp font rendering 2022-06-02 23:36:07 -07:00
Kartik K. Agaram b94b007db5 find text 2022-06-02 22:53:34 -07:00
Kartik K. Agaram 63f59e7c2c scroll if necessary on paste 2022-06-02 19:28:38 -07:00
Kartik K. Agaram 15c54f4383 rename 2022-06-02 19:25:33 -07:00
Kartik K. Agaram 51f4f13ecc test harness now supports copy/paste 2022-06-02 18:52:49 -07:00
Kartik K. Agaram 283c4e5804 bugfix: pasting newlines 2022-06-02 18:35:18 -07:00
Kartik K. Agaram 4f76ea37d7 more efficient undo/redo
Now the bottleneck shifts to applying undo/redo in large files. But
things should be snappy if you don't use the sluggish feature.
2022-06-02 17:46:30 -07:00
Kartik K. Agaram 22817492a3 rename 2022-06-02 16:44:18 -07:00
Kartik K. Agaram 477216a051 this implementation undo load-tests quite poorly
Even a 10KB file gets sluggish within the first 1k characters inserted.

We're not running out of memory, we're just overloading Lua's GC.
2022-06-02 16:29:18 -07:00
Kartik K. Agaram 670886240f after much struggle, a brute-force undo
Incredibly inefficient, but I don't yet know how to efficiently encode
undo mutations that can span multiple lines.

There seems to be one bug related to creating new drawings; they're not
spawning events and undoing past drawing creation has some weird
artifacts. Redo seems to consistently work, though.
2022-06-02 15:45:25 -07:00
Kartik K. Agaram 819cb4b1cc avoid scrolling down if possible 2022-05-30 17:24:23 -07:00
Kartik K. Agaram b22bfe82db support non-text lines in Text.to2
Originally I was only using it on cursor line, but there's no reason
that has to be true in general.
2022-05-30 15:40:36 -07:00
Kartik K. Agaram 3b4dacaee8 regression: typing uppercase letters in text 2022-05-30 15:36:53 -07:00
Kartik K. Agaram 6aeb89386c . 2022-05-29 16:03:02 -07:00
Kartik K. Agaram f17f5a1192 cut/copy selected text to clipboard 2022-05-29 15:33:24 -07:00
Kartik K. Agaram 23e9be3e10 selecting text and deleting selections
I've written a few tests for delete_selection, but the way different
operations initialize the selection seems fairly standard and not worth
testing so far.
2022-05-29 08:12:47 -07:00
Kartik K. Agaram 524157fb8a bugfix for non-ASCII 2022-05-29 07:57:35 -07:00
Kartik K. Agaram b0bb105cbe extract a couple of methods 2022-05-28 23:11:53 -07:00
Kartik K. Agaram d58aabe867 extract a couple more methods 2022-05-28 22:45:53 -07:00
Kartik K. Agaram 86532eef4b move some code
I had this idea originally to keep text.lua oblivious to drawings.
But that hasn't been true for some time. Losing battle.
2022-05-28 22:45:08 -07:00
Kartik K. Agaram 18c62fb146 extract a few methods 2022-05-28 22:38:35 -07:00
Kartik K. Agaram e79c895c7d move 2022-05-28 22:27:47 -07:00
Kartik K. Agaram 10c1a70dd0 . 2022-05-28 22:24:17 -07:00
Kartik K. Agaram 916e4ce341 scroll on backspace 2022-05-28 09:41:02 -07:00
Kartik K. Agaram cf94d36a5f . 2022-05-28 09:35:06 -07:00
Kartik K. Agaram 95592b83fb . 2022-05-28 09:31:51 -07:00
Kartik K. Agaram 3266262b1f fix a regression in line wrapping 2022-05-28 09:04:21 -07:00
Kartik K. Agaram 8a3b66c813 scroll on enter 2022-05-28 08:38:49 -07:00
Kartik K. Agaram 0fab1b499d paste in text with M-v 2022-05-26 20:40:50 -07:00
Kartik K. Agaram d1f893a98e M-left/M-right for word-based motions 2022-05-25 15:47:11 -07:00
Kartik K. Agaram 9892bc5d7c extract couple of functions 2022-05-25 15:25:10 -07:00
Kartik K. Agaram cb943b9aeb couple of renames 2022-05-25 15:20:18 -07:00
Kartik K. Agaram 1fa295e599 keep repeated cursor up/down motions from drifting left 2022-05-25 15:08:53 -07:00
Kartik K. Agaram 34950353b9 bugfix: don't append metadata when it already exists 2022-05-25 14:56:21 -07:00
Kartik K. Agaram fd213e6f49 bugfix
I spent 20 minutes converting a manual test to a reproducible automated
one, but in the process I knew exactly what the problem was. Nice.
2022-05-25 14:31:16 -07:00
Kartik K. Agaram c2eee640cf test and App helper for mouse clicks 2022-05-25 13:38:33 -07:00
Kartik K. Agaram 442133fe7f no, make sure to compute line width after screen dimensions 2022-05-25 13:35:32 -07:00
Kartik K. Agaram fa103ca2e8 couple more tests
Along with the App helpers needed for them.
2022-05-25 12:59:12 -07:00
Kartik K. Agaram 2999605530 bugfix: down arrow doesn't scroll up unnecessarily
up arrow doesn't seem to have the symmetric issue.
2022-05-24 15:03:06 -07:00
Kartik K. Agaram 84973b09e3 bugfix
Found while reading https://www.gutenberg.org/ebooks/52091
2022-05-24 14:34:58 -07:00
Kartik K. Agaram e581a2b7d1 get rid of debug variables 2022-05-23 23:00:07 -07:00
Kartik K. Agaram 8d5ac5da75 keep one screen line of overlap on pagedown
I'm now extracting the concern of computing
line.screen_line_starting_pos out of Text.draw. Earlier
I had to make sure I ran through the whole line to compute
screen_line_starting_pos, but that had the side-effect of updating
Screen_bottom1.pos as well with lines that had never been rendered.

In this process I hit my first bug due to an accidental global. It
doesn't show up in the patch because I accidentally deleted a local
declaration. (I thought I didn't need screen_line_starting_pos anymore,
deleted everywhere, then brought it back everywhere from the bottom of
the function up, but forgot to put back the very first occurrence.)

The amount of yoyoing this caused between App.draw and Text.draw, I very
much have spaghetti on my hands.

Accidental globals are _terrible_ in a program with tests. Cross test
contamination X-(
2022-05-23 22:51:52 -07:00
Kartik K. Agaram b3251b23b5 a few tests for pageup, and a bugfix
It wasn't screen-line aware. Now it is.
2022-05-23 20:57:56 -07:00
Kartik K. Agaram 6b093fe3b4 clean up test progress indicators 2022-05-23 17:40:44 -07:00