Commit Graph

53 Commits

Author SHA1 Message Date
Kartik K. Agaram 219ee11686 ensure tapping on editor brings up soft keyboard 2024-02-16 21:16:29 -08:00
Kartik K. Agaram 1dbd734abb fix yet another place 2024-02-04 17:19:39 -08:00
Kartik K. Agaram 5d4fd4aa93 fix still more issues with the previous scenario
- source editor always expects relative paths
- refresh mocked data

There's still one issue after this: the font size saved in the config
file is the one we use in tests. More broadly, Editor_state is
completely wrong.

Ideally I'd just not save any settings for the source editor if the
tests fail.
2024-01-12 03:35:22 -08:00
Kartik K. Agaram aa6bfb4b15 moar bugfix X-( 2023-12-29 12:02:45 -08:00
Kartik K. Agaram bd2179d8aa bugfix
scenario: run without config file, quit, run again
expected: font size remains the same on second run

Before this commit it was increasing on each run.
It turns out the font height that you pass into love.graphics.newFont()
is not the result of font:getHeight().
2023-12-29 11:52:28 -08:00
Kartik K. Agaram 0f4aea6db7 pull font into editor
Now it adjusts the current font for itself.
And it's up to the caller to adjust the current font after.
2023-12-29 11:18:41 -08:00
Kartik K. Agaram c29be0ffce streamline button.lua 2023-12-16 23:41:10 -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 8399c42707 mouse button state in source editor 2023-12-01 22:07:24 -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 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 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 c43d884b6f indent 2023-09-16 22:41:55 -07:00
Kartik K. Agaram 9241fedf3a port an old fix to source editor 2023-09-16 22:40:46 -07:00
Kartik K. Agaram 6e2137c5b6 bugfix to the helper I added yesterday 2023-09-16 22:39:51 -07:00
Kartik K. Agaram 76f119b7b9 hide line numbers from log browser 2023-09-15 13:30:42 -07:00
Kartik K. Agaram bafc45b028 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.
2023-09-15 08:52:39 -07:00
Kartik K. Agaram 0a12e4c733 change a helper slightly 2023-09-15 08:46:36 -07:00
Kartik K. Agaram 1fd30c0462 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 :/
2023-09-14 22:27:38 -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 637e28f300 port inscript's bugfix to source editor 2023-06-04 12:33:23 -07:00
Kartik K. Agaram c969fcdd85 enhance bugfix of commit a9aa3436f (Dec 2024)
Scenario:
* start out with some text on screen
* select some text A, delete
* select some more text B, delete
* press C-z twice to restore A and B
* press C-y twice

Before this commit only the first C-y was having an effect (deleting B).
The second was failing to delete A.
2023-04-08 21:55:51 -07:00
Kartik K. Agaram 282983d084 switch source side to new screen-line-based render
Also copy over the implementation of links from pensieve.love.
2023-04-03 08:33:07 -07:00
Kartik K. Agaram 24a732ebff update documentation on fragments
I see a path to at least maintain a single fragment per screen line. But
can we do better? It even seems unnecessary to maintain two copies of
the data, chopped up into lines and screen lines.
2023-04-01 18:12:29 -07:00
Kartik K. Agaram f64f680f2b no more Text allocations
Is it just my imagination, or does the app feel lighter and more fluffy?
2023-04-01 18:12:29 -07:00
Kartik K. Agaram 876d6298b4 App.width can no longer take a Text
In the process I discovered the horrible fact that Text.x allocates a new Text.
And it gets called (just once, thank goodness) on every single frame.
2023-04-01 18:12:29 -07:00
Kartik K. Agaram a3e5a1f22d update stale source X-( 2023-03-26 09:55:02 -07:00
Kartik K. Agaram da932ce92d update stale information 2023-03-25 17:19:28 -07:00
Kartik K. Agaram a6dcfc5ac8 some minor cleanup
I can't see the mouse wheel ever setting dx, but it's more obvious now
that the editor doesn't support panning left/right.
2023-03-23 21:38:33 -07:00
Kartik K. Agaram 99faf61abb mouse wheel support 2023-03-23 21:00:09 -07:00
Kartik K. Agaram 8c373fdb60 get rid of all bifold text
It's just uneconomic to maintain given how little I've used it. I have a
bug right now and no time to port the bugfix to all the complexities of
the B side.

I briefly considered tossing out the entire source editor. But I _have_
been using it to browse logs across sessions. The live editor doesn't
quite cover all my use cases just yet.

We now have duplication in the source editor only for:
* syntax highlighting
* hyperlinking [[WikiWords]]
* ability to hide cursor (when showing file browser or Focus is in log browser)
2023-03-17 21:48:29 -07:00
Kartik K. Agaram ae429cd78a bring a few things in sync between run and source 2023-03-17 21:40:51 -07:00
Kartik K. Agaram 81ebc6a559 bugfix: disallow font size of 0
Thanks Mikoláš Štrajt.
2023-03-17 19:58:53 -07:00
Kartik K. Agaram d65b7950a1 state validation in source editor as well 2023-03-17 10:46:50 -07:00
Kartik K. Agaram 224e8fe85a bugfix
scenario:
  press ctrl+f, type in a string
  hit down arrow if needed until the screen scrolls
  press enter
  click with the mouse somewhere

Before this commit the app would crash because cursor was above screen
top.
2023-02-09 23:09:23 -08:00
Kartik K. Agaram a9aa3436fa bugfix
Scenario: make some edits, select some text, make some more edits. Press
ctrl-z.

Before this commit, undo would stop at the point of selection and
previous edits would become unreachable.

After this commit, both ctrl-z and ctrl-y seem able to span the point of
selection.
2022-12-24 19:24:48 -08:00
Kartik K. Agaram 53fbb905e3 typo 2022-12-24 19:24:48 -08:00
Kartik K. Agaram e0448d7d7f consistent names in a few more places 2022-12-23 19:32:58 -08:00
Kartik K. Agaram 2b3e09ca0f make love event names consistent
I want the words to be easy to read, and to use a consistent tense.
update and focus seem more timeless; let's make everything like those.
2022-12-23 18:52:28 -08:00
Kartik K. Agaram 1d27d59533 repeat bugfix on source editor X-( 2022-12-12 23:47:59 -08:00
Kartik K. Agaram 35f81e5139 repeat bugfix on source editor 2022-12-12 22:50:08 -08:00
Kartik K. Agaram 4335669ecc repeat bugfix on source editor 2022-11-27 22:27:23 -08:00
Kartik K. Agaram 44aa8226c4 ctrl+a: select entire buffer 2022-11-19 00:27:20 -08:00
Kartik K. Agaram 0e0f36f8b4 stop tracking wallclock time
We only need time differences.
2022-11-03 21:02:31 -07:00
Kartik K. Agaram 141d41aec5 hide editor cursor while in file navigator 2022-09-18 01:32:23 -07:00
Kartik K. Agaram b90a54a9cb new test 2022-09-15 11:26:45 -07:00
Kartik K. Agaram 511db8cffd bugfix: path munging on Windows 2022-09-10 19:23:34 -07:00
Kartik K. Agaram 06c784b576 self-documenting 0 Test_right_margin 2022-09-07 10:16:24 -07:00
Kartik K. Agaram c112b8fadf switch shortcuts for bifold text
I've been running out of ctrl+ shortcuts, and I just remembered my
original idea to keep ctrl+ for drawings/mouse operations and alt+ for
everything else.
2022-09-06 18:39:46 -07:00
Kartik K. Agaram 73fefa7d09 support selections in the source editor
I've only tested side A so far, and included a statement of how I want
side B to behave.
2022-09-06 10:05:20 -07:00