| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
| |
Not really useful here, but other forks might make use of it.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Renamed from the 'error' state.
Now we no longer overload Error_message; it's only used for actual
errors that trigger opening the source editor.
I was tempted to hide Skip_rest_of_key_events inside the 'warning' state
as well, but that isn't right. It applies to all Current_app
transitions, not just those in and out of 'warning'.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I'm starting to feel better after replacing 1 line with 20 and 2 new
bits of global state. I'm now handling two scenarios more explicitly:
* If I change Current_app within key_press, the corresponding text_input
and key_release events go to the new app. If it's an editor it might
insert the key, which is undesirable. Putting such handlers in
key_release now feels overly clever, particularly since it took me
forever to realize why I was getting stuck in an infinite loop.
* Both 'run' and 'source' can hit the version check, so we need to be
able to transition from the 'error' app to either. Which
necessitates yet another global bit of state: Next_app.
|
|
|
|
| |
This is still ugly, but hopefully easier to follow.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When I stopped running the version check before the tests I also stopped
initializing Version, which can be used in tests to watch out for font
changes across versions. As a result I started seeing a test failure
with LÖVE v12.
It looks like all manual tests pass now. And we're also printing the
warning about version checks before running tests, which can come in
handy if a new version ever causes test failures. The only thing that
makes me unhappy is the fact that we're calling the version check twice.
And oh, the fact that this part around initialization and version
management is clearly still immature.
I'll capture some desires and fragmentary thought processes around them:
* If there's an error, go to the source editor.
* But oh, don't go to source editor on some unactionable errors, so we
include a new `Current_app` mode for them:
* Unsupported version requires an expert. Just muddle through if you
can or give a warning someone can send me.
* A failing test might be spurious depending on the platform and font
rendering scheme. So again just provide a warning someone can send
me.
[Source editor can be confusing for errors. Also an editor! But not
showing the file you asked for!]
* But our framework clears the warning after running tests:
* If someone is deep in developing a new feature and quits -> restore
back in the source editor.
[Perhaps `Current_app` is the wrong place for this third hacky mode,
since we actually want to continue running. Perhaps it's orthogonal to
`Current_app`.]
[Ideally I wouldn't run the tests after the version check. I'd pause,
wait for a key and then resume tests? "Muddle through" is a pain to
orchestrate.]
* We store `Current_app` in settings. But we don't really intend to
persist a `Current_app` of 'error'. Only the main app or 'source'
editor.
[Another vote against storing 'error' in `Current_app`.]
* So we need to rerun the version check after running tests to actually
show the warning.
[Perhaps I need to separate out the side-effect of setting `Version`
from the side-effect of changing `Current_app`. But that's not right
either, because I do still want to raise an error message if the
version check fails before running tests. Which brings us back to
wanting to run the tests after raising the version check..]
One good thing: none of the bugs so far have been about silently
ignoring test failures. I thought that might be the case for a bit,
which was unnerving.
I grew similar muddiness in Mu's bootstrap system over time, with
several surrounding modes around the core program that interacted poorly
or at least unsatisfyingly with each other. On one level it just feels
like this outer layer reflects muddy constraints in the real world. But
perhaps there's some skill I still need to learn here..
Why am I even displaying this error if we're going to try to muddle
through anyway? In (vain) hopes that someone will send me that
information. It's not terribly actionable even to me. But it's really
intended for when making changes. If a test fails then, you want to
know.
The code would be cleaner if I just threw an unrecoverable error from
the version check. Historically, the way I arrived at this solution was:
* I used the default love.errorhandler for a while
* I added xpcall and error recovery, but now I have situations where I
would rather fall back on love.errorhandler. How to tell xpcall
that?
But no, this whole line of thought is wrong. LÖVE has a precedent for
trying to muddle through on an unexpected version. And spurious test
failures don't merit a hard crash. There's some irreducible requirement
here. No point making the code simplistic when the world is complex.
Perhaps I should stop caching Version and just recompute it each time.
It's only used once so far, hardly seems worth the global.
We have two bits of irreducible complexity here:
* If tests fail it might be a real failure, or it might not.
* Even if it's an unexpected version, everything might be fine.
And the major remaining problem happens at the intersection of these two
bits. What if we get an unexpected version with some difference that
causes tests to fail? But this is a hypothetical and not worth thinking
about since I'll update the app fairly quickly in response to new
versions.
|
|
|
|
|
| |
We could now get test failures before the version check, which might be
confusing.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
We have an early exit for 'error' mode in this function.
|
|
|
|
|
|
|
| |
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.)
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Port of a fix "upstream": commit b38f172ceb in template-live-editor.
|
| |
|
| |
|
|
|
|
| |
Thanks eril for the report and patch.
|
| |
|
|
|
|
|
|
| |
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().
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
This is a holdover from the days of bifold text.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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 :/
|
|
|
|
|
|
|
| |
Now that we have decent error handling, I think we can encourage people
to press ctrl+e again.
This reverts commit 4b43e9e85d985bcedd105fa9693ae751e5b6d0b6.
|
|
|
|
| |
This time it really does work with pensieve.love
|
|
|
|
|
| |
Annoying dangers of testing in one fork and committing upstream
(where it isn't used yet).
|