Commit Graph

383 Commits

Author SHA1 Message Date
Kartik K. Agaram a77ba7852e Merge pensieve.love 2024-03-01 19:22:04 -08:00
Kartik K. Agaram 90e195dd64 simplify the palette state machine 2024-03-01 17:52:16 -08:00
Kartik K. Agaram 903d43c63d Merge pensieve.love 2024-02-08 02:51:53 -08:00
Kartik K. Agaram 0bd543b4ae Merge lines.love 2024-02-08 02:50:47 -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 9138182131 Merge pensieve.love 2024-01-15 02:26:04 -08:00
Kartik K. Agaram 25c9249b5f Merge lines.love 2024-01-15 02:24:30 -08:00
Kartik K. Agaram 95d88a8298 use editor state font for width calculations 2024-01-12 05:23:06 -08:00
Kartik K. Agaram d2da8d73cc Merge pensieve.love 2023-12-26 11:28:40 -08:00
Kartik K. Agaram a731e4cf38 Merge lines.love 2023-12-26 11:28:18 -08:00
Kartik K. Agaram e36559d264 bugfix: utf-8 2023-12-26 11:19:23 -08:00
Kartik K. Agaram d87af391f4 Merge pensieve.love 2023-12-18 21:54:51 -08:00
Kartik K. Agaram 744b4f1f8c Merge lines.love 2023-12-18 21:52:43 -08:00
Kartik K. Agaram d76eaf4cd7 Merge pensieve.love 2023-12-09 09:54:41 -08:00
Kartik K. Agaram 0692d52984 Merge lines.love 2023-12-09 09:54:24 -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 9c2f868dc9 Merge pensieve.love 2023-11-25 15:26:59 -08:00
Kartik K. Agaram 8a97860525 Merge lines.love 2023-11-25 15:26:48 -08:00
Kartik K. Agaram f6420efd90 improved handling of other keyboard layouts 2023-11-25 15:20:55 -08:00
Kartik K. Agaram c8311cebc7 Merge pensieve.love 2023-11-24 19:35:55 -08:00
Kartik K. Agaram e2c37839ae Merge lines.love 2023-11-24 19:35: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 ed2a74c043 Merge pensieve.love 2023-11-18 12:18:13 -08:00
Kartik K. Agaram aa592d25c4 Merge lines.love 2023-11-18 12:17:17 -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 43561bc95c Merge pensieve.love 2023-10-16 23:23:13 -07:00
Kartik K. Agaram e682fa1b7a Merge lines.love 2023-10-16 23:22:03 -07:00
Kartik K. Agaram d3be518e69 Merge pensieve.love 2023-07-31 10:25:10 -07:00
Kartik K. Agaram 68df0db543 Merge lines.love 2023-07-31 10:18:43 -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 23faf85faa case-insensitive find (ASCII only) 2023-07-25 22:16:56 -07:00
Kartik K. Agaram 7fd1f0268f bugfix: page-up
Before this commit it was scrolling up too much. Like, 2 screens up
instead of 1.

This commit seems like a follow-up to commits dabb7a6c4 and a9a8d5c17.
I'm not analyzing it too much, just focusing on this location after some
debug logs.

Those commits should probably have noticed the missing symmetric
keystroke. But I'm probably ignoring similar concerns in dealing with
this so superficially.
2023-06-14 23:52:46 -07:00
Kartik K. Agaram 5ba9aa9e57 new bug: screen_bottom1 might never be written
Scenario: press C-f and search for something.
Some of the time we get a crash with this call stack:

  Error
  text.lua:970: attempt to compare nil with number

  Traceback
  [love "callbacks.lua"]:228: in function 'handler'
  text.lua:970: in function 'lt1'
  search.lua:72: in function 'search_next'
  run.lua:985: in function 'search_next_in_pane'
  run.lua:939: in function 'search_next'
  run.lua:784: in function 'text_input'
  main.lua:237: in function <main.lua:230>
  app.lua:31: in function <app.lua:22>
  [C]: in function 'xpcall'

Not fixed yet.

The cause: plan_draw is conservative and sometimes tries to render panes
that never overlap the viewport.

This bug was exacerbated by fixing the inscript bug which started
setting screen_bottom1 to nil. But the problem existed before as well,
we just operated on stale screen_bottom1 locations.

This bug doesn't generalize to many other scenarios. It isn't a problem
for forks without the surface metaphor, though it might affect
driver.love as well. Even in pensieve.love, the only place that uses
screen_bottom while spanning multiple editors is find across the entire
surface.
2023-06-10 17:34:48 -07:00
Kartik K. Agaram e2cb177678 Merge lines.love 2023-06-04 12:40:22 -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 934c033e44 Merge lines.love 2023-05-14 17:30:49 -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 1da7db17c9 Merge lines.love 2023-05-14 17:15:02 -07:00
Kartik K. Agaram 6f80535c4d Merge lines.love 2023-05-06 09:09:29 -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 0c830d55a9 Merge lines.love 2023-04-19 22:14:07 -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 2bbac7eeab Merge lines.love 2023-04-08 22:55:15 -07:00
Kartik K. Agaram 25e7eb99a9 rename a variable 2023-04-08 22:44:13 -07:00