Commit Graph

134 Commits

Author SHA1 Message Date
Kartik K. Agaram eccda8de1f bugfix: keep wrapping lines within window boundaries 2023-11-20 23:25:19 -08:00
Kartik K. Agaram 239077e8e1 bugfix: initial textinput event on iOS
`love.textinput` is fragile on iOS. Various things can cause an app to
stop receiving textinput events. Resizing the window is one reliable
way, but there's also another ghost, something that's triggering on
every frame of LÖVE.

Fortunately, it looks like `love.keyboard.setTextInput(true)` reliably
resubscribes the app to textinput events, regardless of their cause.

https://github.com/love2d/love/issues/1959

The one remaining open question here is why the call in
`App.keychord_press` (equivalent to `love.keypressed`) doesn't fix the
breakage caused by the initial window resize (that happens before any
keys are pressed). I've confirmed that `keypressed` comes before
`textinput` on iOS just like everywhere else.
2023-11-19 10:57:10 -08:00
Kartik K. Agaram 85020fe21d Merge text0 2023-11-18 15:27:16 -08:00
Kartik K. Agaram f08a485f07 Merge text.love 2023-11-18 15:25:32 -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 b55bb76f30 fix startup test failures from the driver
Still klunky in one place: when you open the driver the failing test
isn't highlighted in red. I need to communicate the structured data of
test failures in run-time errors when the tests weren't triggered by a
driver command.
2023-11-17 14:34:54 -08:00
Kartik K. Agaram a428068d3e fix initialization errors using driver.love
Changes inside on.initialize are minefields. Until now, if you made a
mistake when modifying on.initialize, you could end up in a situation
where the app would fail irrecoverably on the next startup. You'd have
to go dig up a text editor to fix it.

After this commit, errors in on.initialize wait for commands from
driver.love just like any other error.

Recovering from errors during initialization is a little different than
normal. I don't know how much of initialization completed successfully,
so I redo all of it.

I think this should be safe; the sorts of things we want to do on
startup tend to be idempotent just like the sorts of things we do within
an event loop with our existing error handling.

Things are still not ideal. Initialization by definition happens only
when the app starts up. When you make changes to it, you won't find out
about errors until you restart the app[1], which can be much later and a
big context switch. But at least you'll be able to fix it in the usual
way. Slightly more seamless[2].

One glitch to note: at least on Linux, an app with an initialization
error feels "sticky". I can't seem to switch focus away from it using
Alt-tab. Hitting F4 on the driver also jarringly brings the client app
back in focus when there was an initialization error. But the mouse does
work consistently. This feels similar to the issues I find when an app
goes unresponsive sometimes. The window manager really wants me to
respond to the dialog that it's unresponsive.

Still, feels like an improvement.

[1] I really need to provide that driver command to restart the app! But
there's no room in the menus! I really need a first-class command
palette like pensieve.love has!

[2] https://lobste.rs/s/idi1wt/open_source_vs_ux
2023-11-17 11:55:57 -08:00
Kartik K. Agaram 90dc7ce6dc run all tests on startup 2023-11-16 22:10:03 -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 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 3fb7854008 Merge text0 2023-10-28 01:05:35 -07:00
Kartik K. Agaram 6cc83d5691 Merge text.love 2023-10-28 01:02:30 -07:00
Kartik K. Agaram aa9a0b0b15 use my name for a dir 2023-10-27 23:58:42 -07:00
Kartik K. Agaram 598b7dfa8c Merge text0 2023-10-16 23:33:19 -07:00
Kartik K. Agaram 6f9f6b591a Merge text.love 2023-10-16 23:31:13 -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 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 2bce6aad55 Merge text0 2023-09-09 09:53:37 -07:00
Kartik K. Agaram b407a2e4b8 Merge text.love 2023-09-09 09:51:16 -07:00
Kartik K. Agaram 790b7f18db yet another bugfix X-(
This time it really does work with pensieve.love
2023-09-09 09:27:56 -07:00
Kartik K. Agaram 0016d668bc two bugfixes
Annoying dangers of testing in one fork and committing upstream
(where it isn't used yet).
2023-09-09 09:09:14 -07:00
Kartik K. Agaram bcd7f6b598 new primitives for reading/writing files
These are like versions in nativefs, but only support absolute paths.
I want to be thoughtful about the precise location at each call-site.

It's a little ugly that app.lua now has a dependency on file.lua. Or
source_file.lua for the source editor.
2023-09-09 08:56:21 -07:00
Kartik K. Agaram 31266e23f5 reorder 2023-09-09 08:27:27 -07:00
Kartik K. Agaram 04540f2fd0 Merge text0 2023-09-08 14:58:54 -07:00
Kartik K. Agaram dab97e2deb Merge text.love 2023-09-08 14:56:57 -07:00
Kartik K. Agaram 87ea2af2da a few more testable file-system operations 2023-09-08 14:03:40 -07:00
Kartik K. Agaram ce0b127296 Merge text0 2023-09-04 14:17:04 -07:00
Kartik K. Agaram 4551f06837 Merge text.love 2023-09-04 14:10:09 -07:00
Kartik K. Agaram adfe94b9fc switch to source editor on error
If we're already in source editor we'll quit as before.

It's ugly that app.lua now knows about run.lua. But it's a start.
2023-09-04 13:07:53 -07:00
Kartik K. Agaram 99495355b4 stop using keyboard.isDown
It doesn't work on Android, and it's not much work to avoid.
2023-09-04 00:22:31 -07:00
Kartik K. Agaram bdab8b1c7e Merge text0 2023-08-30 22:58:21 -07:00
Kartik K. Agaram 8439944681 Merge text.love 2023-08-30 22:55:27 -07:00
Kartik K. Agaram f82c0de502 cleaner API for file-system access
Thanks to physfs and nativefs.lua

nativefs still introduces some inconsistencies with love.filesystem with
relative paths:

  * love.fs.read: reads from save dir if it exists, falls back to source dir if not
  * nativefs.read: reads from save dir if it exists, falls back to source dir if not ✓

  * love.fs.write: always writes to save dir
  * nativefs.write: always writes to source dir (since no restrictions)

  * love.fs.newFile followed by file:open('r'): reads from save dir if it exists, source dir if not
  * nativefs.newFile followed by file:open('r'): always reads from working dir

  * love.fs.newFile followed by file:open('w'): always writes to save dir
  * nativefs.newFile followed by file:open('w'): always writes to working dir

So avoid using relative paths with App primitives.
2023-08-30 19:04:06 -07:00
Kartik K. Agaram 7e97a2a1e7 make a few names consistent with snake_case 2023-08-30 06:44:54 -07:00
Kartik K. Agaram 1759c089d7 Merge text0 2023-08-26 16:16:21 -07:00
Kartik K. Agaram e7085e1e17 Merge text.love 2023-08-26 16:04:20 -07:00
Kartik K. Agaram ca4ad8a9e5 reorganize app.lua and its comments
I was so sure my comments were clear when I wrote this a year ago. They
were shit. So, most probably, is the current iteration. Feedback
appreciated.
2023-08-26 15:15:42 -07:00
Kartik K. Agaram d5f0abb637 Merge text0 2023-06-05 22:41:32 -07:00
Kartik K. Agaram 431f1dfec9 Merge text.love 2023-06-05 22:40:16 -07:00
Kartik K. Agaram 9e17337217 rename modifier_down to key_down
The old name was confusing, as its description showed.
2023-06-05 22:21:04 -07:00
Kartik K. Agaram 484602bd9e Merge text.love 2023-06-04 15:25:46 -07:00
Kartik K. Agaram 3114176ebd change how we handle clicks above top margin 2023-06-03 10:36:05 -07:00
Kartik K. Agaram 207fb4f6b8 Merge text0 2023-05-30 00:34:24 -07:00
Kartik K. Agaram 64df115061 Merge text.love 2023-05-30 00:34:12 -07:00
Kartik K. Agaram e568378ecb wait, fix tests
We had this problem because our test fakes were out of sync with reality.
And just in the source app.
2023-05-30 00:24:16 -07:00
Kartik K. Agaram 5561486cb6 Merge text0 2023-04-19 19:47:42 -07:00
Kartik K. Agaram c95dc559c8 record support for multiple versions 2023-04-19 19:45:17 -07:00
Kartik K. Agaram 967950a59f stop printing tests on terminal 2023-04-14 22:38:55 -07:00