Commit Graph

1711 Commits

Author SHA1 Message Date
Kartik K. Agaram 7076aef656 Merge lines.love 2023-12-03 12:58:42 -08:00
Kartik K. Agaram f6bc670ef6 yet another bugfix to the version check
We could now get test failures before the version check, which might be
confusing.
2023-12-03 12:30:16 -08:00
Kartik K. Agaram f37b45196a speculatively recommend new LÖVE v11.5 in all forks 2023-12-03 12:12:56 -08:00
Kartik K. Agaram 9993014904 bugfix: version check 2023-12-03 12:11:17 -08:00
Kartik K. Agaram d22da0802d Merge lines.love 2023-12-03 11:21:25 -08:00
Kartik K. Agaram 0d3db19c85 clearing starty is redundant in mutations
We'll end up calling Text.redraw_all anyway, which will clear starty and
much more besides.

We'll still conservatively continue clearing starty in a few places
where there's a possibility that Text.redraw_all may not be called. This
change is riskier than most.
2023-12-03 10:32:05 -08:00
Kartik K. Agaram 0cf56ac861 Merge lines.love 2023-12-01 22:15:10 -08:00
Kartik K. Agaram 8399c42707 mouse button state in source editor 2023-12-01 22:07:24 -08:00
Kartik K. Agaram 1ee2ced88a Merge lines.love 2023-12-01 22:02:23 -08:00
Kartik K. Agaram 8a588880b7 manually maintain mouse button press state
Just checking mouse.isDown works if the editor is the entirety of the
app, as is true in this fork. However, we often want to introduce other
widgets. We'd like tapping on them to not cause the selection to flash:
  https://news.ycombinator.com/context?id=38404923&submission=38397715

The right architecture to enforce this is: have each layer of the UI
maintain its own state machine between mouse_press and mouse_release
events. And only check the state machine in the next level down rather
than lower layers or the bottommost layer of raw LÖVE.
2023-12-01 21:56:35 -08:00
Kartik K. Agaram 1572b06cee Merge lines.love 2023-11-25 15:56:28 -08:00
Kartik K. Agaram 9ed7c576e6 port keyboard layout handling to source editor 2023-11-25 15:31:42 -08:00
Kartik K. Agaram 8a97860525 Merge lines.love 2023-11-25 15:26:48 -08:00
Kartik K. Agaram f6420efd90 improved handling of other keyboard layouts 2023-11-25 15:20:55 -08:00
Kartik K. Agaram e2c37839ae Merge lines.love 2023-11-24 19:35:26 -08:00
Kartik K. Agaram c1f7f17f9c bugfix: infinite loop inside a very narrow window
I'm not sure this can trigger everywhere (I've only been able to
exercise it in Lua Carousel), but it seems like a safety net worth
having against future modifications by anybody.
2023-11-24 19:19:29 -08:00
Kartik K. Agaram 0751b38932 establish a fairly fundamental invariant
This commit doesn't guarantee we'll always catch it. But if this
invariant is violated, things can get quite difficult to debug. I found
in the Lua Carousel fork that all the xpcalls I keep around were
actively hindering my ability to notice this invariant being violated.
2023-11-24 19:16:33 -08:00
Kartik K. Agaram a898bb7e10 merge bugfix 2023-11-21 10:11:17 -08:00
Kartik K. Agaram 1a8ceb3c5b Merge lines.love 2023-11-18 15:06:02 -08:00
Kartik K. Agaram 48c05aa77a late-bind my App.* handlers
This came up when trying to integrate my apps with the vudu debugger
(https://github.com/deltadaedalus/vudu). In general, it's a subtle part
of LÖVE's semantics that you can modify event handlers any time and your
modifications will get picked up. Now my Freewheeling Apps will follow
this norm as well.
2023-11-18 14:15:07 -08:00
Kartik K. Agaram aa592d25c4 Merge lines.love 2023-11-18 12:17:17 -08:00
Kartik K. Agaram 007b965b11 audit all asserts
Each one should provide a message that will show up within LÖVE. Stop
relying on nearby prints to the terminal.

I also found some unnecessary ones.

There is some potential here for performance regressions: the format()
calls will trigger whether or not the assertion fails, and cause
allocations. So far Lua's GC seems good enough to manage the load even
with Moby Dick, even in some situations that caused issues in the past
like undo.
2023-11-18 11:32:01 -08:00
Kartik K. Agaram 841034fd9e Merge lines.love 2023-11-12 19:52:13 -08:00
Kartik K. Agaram 5cce511550 remove some dead code
We have an early exit for 'error' mode in this function.
2023-11-12 17:14:37 -08:00
Kartik K. Agaram 7057ac74ec check for 'error' mode in a few more places
In particular, I want to be able to switch to 'error' mode rather than
throw a real error() on test failures, because that's a little more
responsive and might be recoverable. (On some Android devices the font
is slightly different, and tests fail as a result.)
2023-11-12 16:31:12 -08:00
Kartik K. Agaram d94afa6597 Merge lines.love 2023-11-10 16:39:02 -08:00
Kartik K. Agaram d90dff3286 improve a name 2023-11-10 10:21:52 -08:00
Kartik K. Agaram f86ebf6247 clean up a debug print 2023-11-10 10:20:57 -08:00
Kartik K. Agaram 106dc7ad12 Merge lines.love 2023-11-10 08:56:22 -08:00
Kartik K. Agaram a6738b49c4 clean up some cruft from error callstacks
before:

  stack traceback:
    [string "text.lua"]:9: in function 'draw'
    [string "edit.lua"]:200: in function 'draw'
    [string "run.lua"]:140: in function 'draw'
    [string "main.lua"]:162: in function <[string "main.lua"]:155>
    [C]: in function 'xpcall'
    [string "app.lua"]:38: in function <[string "app.lua"]:20>
    [C]: in function 'xpcall'
    [love "boot.lua"]:370: in function <[love "boot.lua"]:337>

after:

  stack traceback:
    text.lua:9: in function 'draw'
    edit.lua:200: in function 'draw'
    run.lua:140: in function 'draw'
    main.lua:162: in function <[string "main.lua"]:155>
    [C]: in function 'xpcall'
    app.lua:38: in function <[string "app.lua"]:20>
    [C]: in function 'xpcall'
    [love "boot.lua"]:370: in function <[love "boot.lua"]:337>
2023-11-10 08:41:56 -08:00
Kartik K. Agaram 8b70258978 remove a no-op regex munging on callstacks
Port of a fix "upstream": commit b38f172ceb in template-live-editor.
2023-11-10 07:24:46 -08:00
Kartik K. Agaram f14c09221e Merge lines.love 2023-10-28 00:02:56 -07:00
Kartik K. Agaram aa9a0b0b15 use my name for a dir 2023-10-27 23:58:42 -07:00
Kartik K. Agaram 5d41640d2f remove stale variable from docs 2023-10-27 23:57:18 -07:00
Kartik K. Agaram 8dd03056ab delete some fixed issues 2023-10-23 01:17:17 -07:00
Kartik K. Agaram 523db004d9 change section delimiters in log for OpenBSD
Thanks eril for the report and patch.
2023-10-20 15:53:03 -07:00
Kartik K. Agaram e682fa1b7a Merge lines.love 2023-10-16 23:22:03 -07:00
Kartik K. Agaram f61976c61a use color alpha in button backgrounds 2023-10-16 22:59:04 -07:00
Kartik K. Agaram 4b3f359526 clearer API for drawing a button
Make it more obvious that the color passed in is just for the background.
The icon will do the rest.
r/g/b keys are more consistent with App.color().
2023-10-16 22:57:46 -07:00
Kartik K. Agaram a19712894c bugfix
Scenario:
  * select a line or two
  * delete
  * press C-z to undo. The lines return and are highlighted.
  * press C-y to redo.

Before this commit the editor was crashing:

  Error
    edit.lua:169: assertion failed!
  Traceback
    [love "callbacks.lua"]:228: in function 'handler'
    [C]: in function 'assert'
    edit.lua:169: in function 'draw'
    text.lua:1064: in function 'cursor_out_of_screen'
    edit.lua:487: in function 'keychord_press'
    run.lua:842: in function 'keychord_press'
    main.lua:215: in function 'keychord_press'
    keychord.lua:11: in function <keychord.lua:5>
    app.lua:31: in function <app.lua:22>
    [C]: in function 'xpcall'

I was forgetting a step in C-y that was done in C-z. Now undo and redo
are symmetric.
2023-10-15 23:23:20 -07:00
Kartik K. Agaram 3736c6d217 Merge lines.love 2023-10-15 14:41:11 -07:00
Kartik K. Agaram ea4a8379fe rfind bugfix: handle empty pattern like string.find 2023-10-15 14:21:41 -07:00
Kartik K. Agaram 6b723363b8 add some tests for rfind 2023-10-15 14:20:55 -07:00
Kartik K. Agaram 07e217546d Merge lines.love 2023-10-09 20:51:00 -07:00
Kartik K. Agaram 69d86cae5b fix all tests in LÖVE v12
This is all quite hacky. Many of my tests are unfortunately brittle to
changes in text rendering. Fortunately there's only one test that
currently requires a hacky special case (and a second test I tweaked
slightly to be more robust).

I can't think of a better approach. It doesn't help to standardize the
font, because version changes still come with changes to text-shaping
algorithms even if the font itself is unchanged. I could base all my
assertions on the widths of individual characters, but that would make
the tests much less readable and not express intent as clearly. So here
we are, with hopefully just a few hacky special cases (there might be a
few more as LÖVE v12 advances towards publication, and in further
versions).
2023-10-09 20:25:08 -07:00
Kartik K. Agaram 6e391d7875 start supporting LÖVE v12
To do this I need some support for multiple versions. And I need an
'error' mode to go with existing 'run' and 'source' modes
(`Current_app`). Most errors will automatically transition to 'source'
editor mode, but some errors aren't really actionable in the editor. For
those we'll use 'error' mode.

The app doesn't yet work with LÖVE v12. There are some unit tests failing
because of differences in font rendering.
2023-10-09 20:05:19 -07:00
Kartik K. Agaram 2f61e8e71e bugfix: stale name 2023-09-25 14:34:23 -07:00
Kartik K. Agaram 9b4caadf3f Merge lines.love 2023-09-20 14:21:55 -07:00
Kartik K. Agaram bd6f7d48e7 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 9656e13774). 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.
2023-09-20 13:39:29 -07:00
Kartik K. Agaram 1b6d04f678 Merge lines.love 2023-09-17 09:21:50 -07:00