Commit Graph

121 Commits

Author SHA1 Message Date
Kartik K. Agaram 9d1bea2941 Merge text.love 2024-02-08 02:54:28 -08:00
Kartik K. Agaram 6b33c9e223 Merge lines.love 2024-02-08 02:52:55 -08:00
Kartik K. Agaram 4e9298dda1 bugfix in cursor positioning
scenario:
- create a long wrapping line
- tap past end of first screen line

Before this commit the cursor would be positioned not quite at the end
of the screen line but one character before. In effect there was no way
to position cursor at end of a wrapping line.

I'm not sure how this bug has lasted so long. It was introduced in
commit 8d3adfa36 back in June 2022, which was itself billed as a bugfix
for "clicking past end of screen line". But when I go back to it this
bug exists even back then. How did I miss it?! I wrote a test back then
-- and the test was wrong, has always been wrong.
2024-02-08 02:37:12 -08:00
Kartik K. Agaram d27c03373c Merge text.love 2024-02-04 17:39:15 -08:00
Kartik K. Agaram 77e1b57446 Merge lines.love 2024-02-04 17:36:01 -08:00
Kartik K. Agaram 1d1a829d5b more carefully pass the 'key' arg around 2024-02-04 09:30:48 -08:00
Kartik K. Agaram d6b2b52006 Merge text.love 2023-12-16 23:52:14 -08:00
Kartik K. Agaram aa4d80f157 Merge lines.love 2023-12-16 23:49:20 -08:00
Kartik K. Agaram c29be0ffce streamline button.lua 2023-12-16 23:41:10 -08:00
Kartik K. Agaram 068d0fc42f Merge text.love 2023-10-09 20:57:53 -07:00
Kartik K. Agaram b84cbf6d21 Merge lines.love 2023-10-09 20:55:24 -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 a508c62497 Merge text.love 2023-09-20 14:33:40 -07:00
Kartik K. Agaram 3aec915559 Merge lines.love 2023-09-20 14:32:01 -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 f881f19f98 Merge text.love 2023-06-04 15:17:36 -07:00
Kartik K. Agaram bf2c2555d6 Merge lines.love 2023-06-04 15:11:24 -07:00
Kartik K. Agaram 9656e13774 bugfix: inscript's bug
To fix this I have to first stop incrementally updating screen_bottom1
in the middle of a frame. Now it always has a good value from the end of
a frame.

I'm also running into some limitations in the test I'd ideally like to
write (that are documented in a comment), but I still get some sort of
automated test for this bugfix.
2023-06-04 12:20:24 -07:00
Kartik K. Agaram cf0ba7c154 handle wrapping lines 2023-06-03 10:44:11 -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 cdef37c419 get rid of recent_mouse
It's a hack:
  - if you start selecting from below final line the start of the
    selection is the most recent click even if it was forever ago
  - (the crash we're currently fixing) if you start up and immediately
    select all then click below final line => crash. recent_mouse was
    never set.
  - getting rid of it breaks no tests (except the crash we're currently
    fixing)
2023-06-01 22:12:12 -07:00
Kartik K. Agaram 9b27a4d816 failing test now looks realistic 2023-06-01 21:59:09 -07:00
Kartik K. Agaram b1e28f5a85 Merge text.love 2023-05-13 17:32:36 -07:00
Kartik K. Agaram 10932bd491 Merge lines.love 2023-05-13 17:29:45 -07:00
Kartik K. Agaram 8e02c2c021 bugfix: searching files containing unicode
Before this change the cursor was moving, but not being highlighted
properly when the cursor line contained unicode before the cursor.
2023-05-13 17:02:10 -07:00
Kartik K. Agaram 24a48e665f Merge text.love 2023-04-02 09:31:56 -07:00
Kartik K. Agaram 3547c18db6 Merge lines.love 2023-04-02 09:22:32 -07:00
Kartik K. Agaram 29f1687f3c avoid saving fragments in lines
Now we render lines one screen line at a time rather than one word at a
time.

I can't port the source side just yet; I need to fix hyperlinks first..
2023-04-01 21:44:27 -07:00
Kartik K. Agaram d3a7b3b8cd Merge text.love 2023-03-19 11:52:32 -07:00
Kartik K. Agaram dc0ad458c9 Merge lines.love 2023-03-19 11:52:10 -07:00
Kartik K. Agaram 0c06c60622 give a test a unique name 2023-03-19 11:48:47 -07:00
Kartik K. Agaram 675d1cbbdf bugfix
Thanks Mikoláš Štrajt.
2023-03-17 21:52:35 -07:00
Kartik K. Agaram 33ad6b7e5b bugfix: up arrow when line above is a drawing
This bug was introduced in commit 528c64d690 on 2022-09-05 :/
2023-01-31 22:39:04 -08:00
Kartik K. Agaram eb26b9ab5e Merge text.love 2023-01-20 22:13:31 -08:00
Kartik K. Agaram 486afb1c68 Merge lines.love 2023-01-20 22:08:39 -08:00
Kartik K. Agaram 2a0a770c49 deduce test names on failures 2023-01-20 21:48:49 -08:00
Kartik K. Agaram d680e1aa4f Merge text.love 2022-12-23 20:46:58 -08:00
Kartik K. Agaram e9a517161b Merge lines.love 2022-12-23 20:46:31 -08:00
Kartik K. Agaram 8b9dab0c36 overzealous search-and-replace 2022-12-23 20:42:12 -08:00
Kartik K. Agaram 8e78294795 Merge text.love 2022-12-23 19:53:38 -08:00
Kartik K. Agaram 4854165630 Merge lines.love 2022-12-23 19:47:10 -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 df0aec10d0 streamline one more test name 2022-12-13 09:50:36 -08:00
Kartik K. Agaram 03be29885f more streamlined test names
https://lobste.rs/messages/e1rimy
2022-12-13 09:43:55 -08:00
Kartik K. Agaram 2dd2b16295 remove a duplicate test 2022-12-13 09:05:31 -08:00
Kartik K. Agaram aeea740891 new fork: browse an immutable text file
Still has a cursor, which might be unnecessary.
2022-08-20 11:14:33 -07:00
Kartik K. Agaram a655c2113c bring back a level of wrapping
Many projects will require the ability to add metadata to lines, so
let's not drop that.
2022-08-15 11:00:35 -07:00
Kartik K. Agaram 9d792a203b new fork: rip out drawing support 2022-08-14 09:20:14 -07:00
Kartik K. Agaram f3df1cda0f bugfix: check after cursor on same line when searching upwards 2022-08-11 22:23:16 -07:00
Kartik K. Agaram e85a7e73d0 bugfix: search upwards 2022-08-11 22:23:16 -07:00