~akkartik/text.love

3aec9155 — Kartik K. Agaram 13 days ago main
Merge lines.love
bd6f7d48 — Kartik K. Agaram 13 days ago
bugfix: clear selection when clicking above or below lines

Matt Wynne pointed out that snap.love would crash when a node went off
screen. While debugging it I noticed that selection1 was being set when
it shouldn't be.

Turns out I introduced a bug when I fixed the inscript bug back in June
(commit 9656e137742). One invariant I want to preserve is: selection1
should be unset after a mouse click (press and release without
intervening drag). This invariant was violated in my bugfix back in
June. I was concerned only with selection back then, and I didn't
realize I was breaking the mouse click case (in a fairly subtle way; you
can have selection set, and when it's set identically to the cursor
everything looks the same).

I think there might still be an issue in snap.love after this fix. I
noticed screen_bottom1.pos was nil, and as far as I recall that should
never happen.
5c5a8a88 — Kartik K. Agaram 16 days ago
Merge lines.love
c43d884b — Kartik K. Agaram 17 days ago
indent
9241fedf — Kartik K. Agaram 17 days ago
port an old fix to source editor
6e2137c5 — Kartik K. Agaram 17 days ago
bugfix to the helper I added yesterday
e1168f4e — Kartik K. Agaram 17 days ago
fix a bad merge
09c76c82 — Kartik K. Agaram 17 days ago
Merge lines.love
715c6fd3 — Kartik K. Agaram 18 days ago
source: show file being edited in window title bar
6ed60848 — Kartik K. Agaram 18 days ago
delete some dead code

This is a holdover from the days of bifold text.
76f119b7 — Kartik K. Agaram 18 days ago
hide line numbers from log browser
ab5ba3f3 — Kartik K. Agaram 18 days ago
assume starty can be nil in update

This is a backport of a bugfix in pensieve.love. It's not _technically_
a bug here in lines.love, but it seems worth establishing an
architectural invariant (or rather lack of invariant).

LÖVE's standard event loop performs the following sequence of operations
in a single frame:
  * process events
  * update
  * draw

Ideally any mutations to global state happen during the first two
phases, while drawing includes no mutation.

However, there is a special case: `starty`, the top y coordinate for
each each line in the editor. This is used all over the place, and the
cheapest way to compute it is to simply save it while drawing.

However, draw by definition only updates `starty` for lines that are
drawn on screen. To avoid stale data on lines off screen, say after
scrolling, events often clear `starty` for all lines, leaving it to the
next draw phase to repopulate the right lines.

Sandwiched between the above two "however"s, the update phase needs to
gracefully handle `starty` being nil in the occasional frame right after
an event.

I think I've audited all our uses of `starty`, and this commit fixes the
only place that violates this rule.
bafc45b0 — Kartik K. Agaram 18 days ago
bugfix: crash when using mouse wheel

All the Text functions assume the cursor is always on a text line. I was
violating that invariant.

* When scrolling up, I start the cursor at the top-most line below the
  screen top.

* When scrolling down, I start the cursor at the top-most line below the
  screen bottom.

  I think it would feel slightly more natural for it to be the
  bottom-most line above the screen bottom.

  However, the Text functions maintain an invariant that the bottom-most
  line in a buffer will be text. There's no such invariant for the
  top-most line.
0a12e4c7 — Kartik K. Agaram 18 days ago
change a helper slightly
0e20565e — Kartik K. Agaram 18 days ago
clean up a slight jitter when drawing circles

Earlier the ghost while drawing wouldn't quite match the final shape.
Now the math is identical in draw_pending_shape.

It's a little unfortunate that we have this duplication of formulae.

At least there are no other stray calls of App.mouse_x in
draw_pending_shape.
1a88b4a2 — Kartik K. Agaram 19 days ago
Merge lines.love
1fd30c04 — Kartik K. Agaram 19 days ago
always show line numbers in source editor

The drawing buttons are now absolutely positioned, which is a horrible
hack. But for just the source editor it seems good enough. The
alternative is to modify magic constants in all the tests :/
37cb0304 — Kartik K. Agaram 23 days ago
Merge lines.love
70629638 — Kartik K. Agaram 23 days ago
Revert "deemphasize the source editor"

Now that we have decent error handling, I think we can encourage people
to press ctrl+e again.

This reverts commit 4b43e9e85d985bcedd105fa9693ae751e5b6d0b6.
28a6bb37 — Kartik K. Agaram 24 days ago
Merge lines.love
Next