Commit Graph

371 Commits

Author SHA1 Message Date
Kartik K. Agaram 1c56b9d644 clean up memory leak experiments 2022-06-10 13:46:59 -07:00
Kartik K. Agaram 88209ec343 while we're at it, undo naming points 2022-06-10 13:45:50 -07:00
Kartik K. Agaram 242a087016 set current_drawing_index with current_drawing 2022-06-10 13:44:12 -07:00
Kartik K. Agaram fcfe667fe9 include drawing index in a few places 2022-06-10 13:40:07 -07:00
Kartik K. Agaram c93553b670 . 2022-06-10 12:01:46 -07:00
Kartik K. Agaram c875f7be46 stop saving the entire file when modifying drawings
Now we just disallow that entirely.
2022-06-10 11:48:32 -07:00
Kartik K. Agaram 79a1241370 undo creating new drawings 2022-06-10 11:45:53 -07:00
Kartik K. Agaram fcacb6e63d extract scrolling logic out of insert_at_cursor 2022-06-10 11:29:01 -07:00
Kartik K. Agaram 31418976d4 extract scrolling logic out of insert_return 2022-06-10 11:21:41 -07:00
Kartik K. Agaram 69c5d844cc remove some memory leaks from rendered fragments
All signs so far seem to be that CPU is cheap for this application, but
memory is expensive. It's easy to get sluggish if the GC comes on.

After some experiments using https://github.com/yaukeywang/LuaMemorySnapshotDump,
one source of memory leaks is rendered fragments (https://love2d.org/wiki/Text
objects). I need to render text in approximately word-sized fragments to
mostly break lines more intelligently at word boundaries.

I've attached the files I used for my experiments (suffixed with a '.')

There's definitely still a leak in fragments. The longer I edit, the
more memory goes to them.
2022-06-10 11:16:41 -07:00
Kartik K. Agaram fbad3dd205 avoid some string concatenations
file:write can write multiple args one after another; no need to
concatenate them first.

I'm starting to pay attention to memory usage after the experience of
turning off the JIT.
2022-06-10 07:14:45 -07:00
Kartik K. Agaram f554ce878b include a unit test 2022-06-09 18:36:16 -07:00
Kartik K. Agaram 4476eb8946 bugfix: cut (C-x) without first selecting anything 2022-06-09 18:27:09 -07:00
Kartik K. Agaram 6ba10b4de6 fix a corner case when selecting text
The hard part here is keeping click-drag selection working (without
pressing and holding shift).
2022-06-09 15:49:16 -07:00
Kartik K. Agaram fa5bf1218a move 2022-06-09 15:48:07 -07:00
Kartik K. Agaram 8f823bf430 . 2022-06-09 15:22:21 -07:00
Kartik K. Agaram 173d3a3de0 test both ways of selecting text with mouse 2022-06-09 15:09:32 -07:00
Kartik K. Agaram fe170fc579 experiment: blinking cursor
I've tried to keep the time period of the blinking similar to my
terminal.

Honestly I'm no longer sure if any of my experiments are showing a
statistically significant result. Let's see how it feels over a period
of time.
2022-06-09 13:47:41 -07:00
Kartik K. Agaram 25190676ea the problem is that the cursor can occlude text
And anything we do to reduce the occlusion also makes the cursor harder
to acquire.

I suppose this is why we need the blink.
2022-06-09 13:39:41 -07:00
Kartik K. Agaram 06fae39088 make the cursor a little thicker
I'm testing this by moving the cursor around with my eyes closed, then
starting a stopwatch as I open my eyes. This seems to help a bit. I'm
able to acquire the cursor in 2s. At least the 10s outliers I used to
have with the circle or thin line don't seem to be happening.
2022-06-09 13:26:49 -07:00
Kartik K. Agaram b418e60e6a experiment: line cursor 2022-06-09 13:20:05 -07:00
Kartik K. Agaram 7be2718f0f fix contact link 2022-06-09 12:16:03 -07:00
Kartik K. Agaram 712dc95985 experiment: turn off JIT
This seems to speed up copy! What does it slow down?
2022-06-09 08:15:32 -07:00
Kartik K. Agaram 4ad51d648b move 2022-06-09 07:29:38 -07:00
Kartik K. Agaram e77157d316 speeding up copy, attempt 1
Problem: repeatedly copying (relatively large) sections of text quickly
makes the app sluggish until it has to be killed. (Thanks John Blommers
for the report.)

When I instrument with prints, the sluggishness seems to happen in
random draw() calls many times after I perform the copy.

I don't know for sure, but I'm initially checking if the cause is
garbage generated by repeated string concatenation.

This attempt doesn't seem to make any difference.
2022-06-09 07:24:40 -07:00
Kartik K. Agaram ac4879bb85 more defensive resize handling
Thanks John Blommers for the report!
2022-06-07 21:55:48 -07:00
Kartik K. Agaram 12f5fa9bed forgot to commit documentation for the commandline arg 2022-06-07 14:20:54 -07:00
Kartik K. Agaram ff08bbe7f4 first commandline arg: window dimensions
Hopefully there won't be too many others.
2022-06-07 14:11:09 -07:00
Kartik K. Agaram 6b628781d1 use app name in window title 2022-06-07 13:59:26 -07:00
Kartik K. Agaram 7b78c359b6 clearer discription of how to run lines.love 2022-06-07 13:58:38 -07:00
Kartik K. Agaram 1e33eeeffc a likely source of issues 2022-06-07 13:48:59 -07:00
Kartik K. Agaram faee5f9047 warn on unused commandline args 2022-06-07 13:35:56 -07:00
Kartik K. Agaram 0337d75933 obsolete comment 2022-06-07 13:35:22 -07:00
Kartik K. Agaram 4c0095ea46 extract a function 2022-06-07 13:24:43 -07:00
Kartik K. Agaram 33ea91f8d9 allow the window to be resized
This still isn't ideal. On my Linux laptop for some reason the window
receives a signal to maximize itself soon after (but sometime after) the
program starts.
2022-06-07 13:19:17 -07:00
Kartik K. Agaram bc46cef4e5 freudian typo 2022-06-07 12:34:58 -07:00
Kartik K. Agaram f7afc61b22 fix a crash
This one isn't worth debugging. We know how to recreate this data on
demand.
2022-06-06 18:57:46 -07:00
Kartik K. Agaram f0e967d2a1 flesh out Readme 2022-06-06 18:33:44 -07:00
Kartik K. Agaram 8780276f0c another known issue 2022-06-06 17:30:03 -07:00
Kartik K. Agaram 612e08571f autosave on cut/paste 2022-06-05 12:55:36 -07:00
Kartik K. Agaram b1c7ebdca3 additional logging for an active bug 2022-06-05 12:04:21 -07:00
Kartik K. Agaram a70d7ba8bc . 2022-06-05 10:30:23 -07:00
Kartik K. Agaram d043745ccd record another known issue I don't know how to fix yet
Perhaps I need to switch to the next more sophisticated data structure for Lines:
a gap buffer around the line the cursor is on.

I'm not sure why it would help here, though.
2022-06-05 10:28:42 -07:00
Kartik K. Agaram 9cafed99f4 another bugfix in scrolling while inserting text
I'm being unprincipled at the moment between pos and x,y coordinates.
Whatever is more convenient. Perhaps a cleaner approach will come to me
over time.
2022-06-05 10:08:28 -07:00
Kartik K. Agaram e7a985bd0a bugfix in previous commit
I almost pushed this to production. That would have been catastrophic;
the very first keystroke anyone typed into the editor would have failed.

And in the process, this fixes the next bug on my TODO list! Paste on
first line wasn't working. Now it is.
2022-06-05 09:51:54 -07:00
Kartik K. Agaram de473046bc check for scroll when just typing 2022-06-05 08:29:38 -07:00
Kartik K. Agaram 5055361209 rename 2022-06-05 08:11:50 -07:00
Kartik K. Agaram 3f07ac51d2 some unnecessary mutations
Why are we not modifying Screen_top1.pos in these places? Because we
don't really need to modify Screen_top1 at all.
2022-06-05 08:11:33 -07:00
Kartik K. Agaram 8c0f54ee64 some typos 2022-06-05 07:59:44 -07:00
Kartik K. Agaram 6267ddd2eb bugfix: backspace from start of file 2022-06-04 22:13:34 -07:00