Commit Graph

108 Commits

Author SHA1 Message Date
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 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 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 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 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 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 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 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 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 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 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 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 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
Kartik K. Agaram 0afd03e721 bugfix: check before cursor on same line 2022-08-11 22:23:16 -07:00
Kartik K. Agaram da34fabf72 bugfix: pagedown was sometimes bouncing up 2022-08-10 22:56:10 -07:00
Kartik K. Agaram ba48aadaa7 bugfix: backspace from start of final line 2022-08-10 22:38:10 -07:00
Kartik K. Agaram 0218980add click to the left of a line 2022-07-29 14:38:45 -07:00
Kartik K. Agaram 4ce716fe44 line.y -> line_cache.starty in a few more places
Disquieting that none of my tests caught these. On the other hand, I
also haven't noticed any issues in practice. Perhaps cache invalidation
is often unnecessary.
2022-07-27 20:45:46 -07:00
Kartik K. Agaram 3265abacb4 bugfix: skip over drawings when searching 2022-07-25 09:49:26 -07:00
Kartik K. Agaram 0251b3f0c2 bugfix: search
Broken since commit 188bbc73 9 days ago :/ At least we have a test for
it now.
2022-07-21 16:55:05 -07:00
Kartik K. Agaram e2734cd572 bugfix: where cursor is drawn
The published version of lines.love was broken for almost an hour. The
cursor would render one position to the right of where it really is. To
fix it, this commit rolls back 26ba6e4e5a. There doesn't seem a good
way to test it.
2022-07-20 09:11:29 -07:00
Kartik K. Agaram 9f4b41d829 exclude left margin from my word-split heuristic
Gratifying how few tests need changing. Recent commits seem on the right
track.
2022-07-20 07:15:46 -07:00
Kartik K. Agaram a472d218f2 allow Text.nearest_pos_less_than to return 0
This eliminates another case of overflowing margins.
2022-07-20 07:08:28 -07:00
Kartik K. Agaram 26ba6e4e5a unify two similar functions
The cost is just having to tweak a few more brittle tests. I can't
actually perceive any difference in how the cursor moves when I click on
text.
2022-07-19 17:13:16 -07:00
Kartik K. Agaram efd4a8a883 keep text from overflowing right margin
I've been sloppy about this so far, and outside of tests I can't find
any examples where it matters, but it matters in a potential fork where
I'm rendering multiple columns of text.

It's unfortunate that my tests have this level of brittleness. What I'd
really like to assert in many of these changed lines is that the text
stays inside the margins and that more text would overflow margins.
2022-07-19 16:49:08 -07:00
Kartik K. Agaram cc5ab51c53 delete some duplicate initialization 2022-07-19 08:04:21 -07:00