Commit Graph

352 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 dedb843535 Merge text.love 2024-01-15 01:45:35 -08:00
Kartik K. Agaram 348852ee2b Merge lines.love 2024-01-15 01:38:38 -08:00
Kartik K. Agaram 95d88a8298 use editor state font for width calculations 2024-01-12 05:23:06 -08:00
Kartik K. Agaram 320f68ba43 Merge text.love 2023-12-26 11:30:56 -08:00
Kartik K. Agaram 2b1c48c08e Merge lines.love 2023-12-26 11:29:52 -08:00
Kartik K. Agaram e36559d264 bugfix: utf-8 2023-12-26 11:19:23 -08:00
Kartik K. Agaram 3752993b34 Merge text.love 2023-12-09 10:00:27 -08:00
Kartik K. Agaram 67e3a43b52 Merge lines.love 2023-12-09 09:59:09 -08:00
Kartik K. Agaram 961f296131 fix a couple of asserts missed in the recent audit 2023-12-09 09:22:45 -08:00
Kartik K. Agaram e0625d0ad6 Merge text.love 2023-11-25 15:29:25 -08:00
Kartik K. Agaram aed0eb592a Merge lines.love 2023-11-25 15:27:12 -08:00
Kartik K. Agaram f6420efd90 improved handling of other keyboard layouts 2023-11-25 15:20:55 -08:00
Kartik K. Agaram 00e0e346b3 Merge text.love 2023-11-24 19:37:55 -08:00
Kartik K. Agaram 5561ebf06f Merge lines.love 2023-11-24 19:36:26 -08:00
Kartik K. Agaram c1f7f17f9c bugfix: infinite loop inside a very narrow window
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.
2023-11-24 19:19:29 -08:00
Kartik K. Agaram 0751b38932 establish a fairly fundamental invariant
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.
2023-11-24 19:16:33 -08:00
Kartik K. Agaram a65d460c01 Merge text.love 2023-11-18 12:27:46 -08:00
Kartik K. Agaram de66b015bc Merge lines.love 2023-11-18 12:21:30 -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 47897d3df3 Merge text.love 2023-07-31 10:43:07 -07:00
Kartik K. Agaram 3b88c6540d Merge lines.love 2023-07-31 10:26:19 -07:00
Kartik K. Agaram bb3e12eb5f bugfix: search highlight straddling screen lines 2023-07-31 09:15:48 -07:00
Kartik K. Agaram 2b52383e18 remove a duplicate print to screen
In addition to being more efficient, this will simplify the next bugfix.
2023-07-31 08:56:20 -07:00
Kartik K. Agaram 8879fd6f29 extract a variable 2023-07-31 08:49:24 -07:00
Kartik K. Agaram d6c06db97a bugfix: highlight search patterns on the right line
scenario:
* position a wrapped line on screen
* search for the word immediately after the point of wrapping

Before this commit the word would be highlighted twice:
  - at the end of the first screen line
  - at the start of the second screen line

Now it shows up at the right place.
2023-07-31 08:40:22 -07:00
Kartik K. Agaram f7f42b0bef hoist and duplicate a conditional
I'm duplicating the bounds check when drawing cursor and search
highlight because they're separate concerns and require subtly different
logic.
2023-07-31 08:40:07 -07:00
Kartik K. Agaram 484b76f5c6 improve a comment 2023-07-31 08:21:38 -07:00
Kartik K. Agaram 037fb843c8 stop showing the cursor 2023-06-07 21:57:39 -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 b071ba51a3 Merge text.love 2023-05-14 17:32:31 -07:00
Kartik K. Agaram 0f3841f186 Merge lines.love 2023-05-14 17:31:55 -07:00
Kartik K. Agaram c96be4b007 add an assert
I added this to catch a rare bug. I've had it locally for a few weeks
now without hitting it. Doesn't hurt to publish it.
2023-05-14 17:23:08 -07:00
Kartik K. Agaram f2a52b2d43 Merge text.love 2023-05-06 09:12:30 -07:00
Kartik K. Agaram e39fe490e4 Merge lines.love 2023-05-06 09:09:48 -07:00
Kartik K. Agaram 6a1d8e5164 bugfix: never use utf8 pos in string.sub
This is a violation of an existing rule in Manual_tests.md. The
following command weakly suggests there aren't any others:
  grep ':sub(' *.lua |grep pos
2023-05-06 08:56:44 -07:00
Kartik K. Agaram 22071c9b71 remove some support for long lines from source editor
A code editor is unlikely to need support for extremely long lines. And
that kind of scroll is jarring anyway in a code editor. We don't read
code like a novel, and less scroll per page implies more scrolling work.

I'd gotten rid of this functionality and the test for it [1] back in the
spokecone fork, but only took out the test when first pulling it into
the source editor.

[1] test_pagedown_often_shows_start_of_wrapping_line
2023-04-19 21:53:11 -07:00
Kartik K. Agaram 134ce14b44 Merge text.love 2023-04-08 22:57:22 -07:00
Kartik K. Agaram b3a3321cd6 Merge lines.love 2023-04-08 22:57:01 -07:00
Kartik K. Agaram 25e7eb99a9 rename a variable 2023-04-08 22:44:13 -07:00
Kartik K. Agaram bc3f1aca36 Merge text.love 2023-04-03 09:23:54 -07:00
Kartik K. Agaram e406fdae0d Merge lines.love 2023-04-03 09:23:28 -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 95342345a8 change cursor bounds check slightly
This doesn't affect this fork directly, but it's a bad idea to assume
the _app_ is always going to be doing just what a particular subsystem
(here, the text editor in edit.lua+text.lua) is doing.
2023-04-02 17:24:02 -07:00
Kartik K. Agaram 384fb2d19c streamline the interface for Text.draw 2023-04-02 17:19:03 -07:00
Kartik K. Agaram 24a48e665f Merge text.love 2023-04-02 09:31:56 -07:00