Commit Graph

11 Commits

Author SHA1 Message Date
Kartik K. Agaram 8d9af77ab1 clean up all the mess since commit fe4e1395d0
In the process we find a new bug. Scrolling with keyboard is overly
eager to clamp screen_top to bottom of screen when the top used to be
within the viewport.

Until recently, scrolling past the bottom when the margin was visible
would move the cursor correctly but pan the surface to the top of the
viewport. Slightly jarring, but good enough.
2023-10-25 17:59:38 -07:00
Kartik K. Agaram ed08869d25 fix a stupid mistake
Everything seems to be working now!
2023-10-25 17:48:00 -07:00
Kartik K. Agaram 45c1e42de2 snapshot: a cleaner organization
scenarios:
  * Zoom = 1
    * pan with mouse: ✓
    * pan with up arrow: ✓
    * pan with down arrow: ✓
  * Zoom < 1
    * pan with mouse: ✓
    * pan with up arrow: ✓
    * pan with down arrow: ✗
  * Zoom > 1
    * pan with mouse: ✓
    * pan with up arrow: ✗
    * pan with down arrow: ✓

What ✓ means:
* pan with mouse: lines don't slide relative to the surface
  * will still slide relative to the surface when zooming in/out;
    that's unavoidable because we want integer pixels for crisp text
* pan with keyboard: at least some part of cursor is always peeking within the viewport
  * might still look ugly, with the line containing the cursor almost invisible,
    but hitting the down arrow will never pan upwards, or vice versa

Still not working though. I'm pretty much guaranteeing by construction that if
Viewport.y was set from screen_top1, then screen_top1 will not be perturbed.
And yet using scale() inside update_editor_box is incorrect. Hmm..
2023-10-25 16:49:39 -07:00
Kartik K. Agaram 0a37b1b80c revert commit 4c8960b5c7
Well, almost. I'm just reminding myself of the sort of plumbing I need,
not reintroducing the old logic that never worked right and had
undergone n iterations of corruption.
2023-10-25 16:23:28 -07:00
Kartik K. Agaram 4c8960b5c7 greatly simplify layout
I don't know why this was so hard, but I don't need this variable
preserve_screen_top_of_cursor_node at all. We only set it when the
cursor is in some node, but we also only check for when the current node
is the cursor. Comparing with a nil cursor node works just as well.

I've also checked that driver.love doesn't need
preserve_screen_top_of_cursor_node. I think it came from pensieve.love,
where I've since taken it out. Did I ever need it even there?
2023-10-21 09:57:44 -07:00
Kartik K. Agaram b0e870b293 bugfix: node width shouldn't be scaled by zoom
Instead, we're scaling font size by zoom.
2023-06-21 22:15:14 -07:00
Kartik K. Agaram f9784faaf7 indent 2023-06-21 22:12:46 -07:00
Kartik K. Agaram 50449ba7c6 . 2023-06-20 22:10:14 -07:00
Kartik K. Agaram 8a95025036 borders around editor nodes 2023-06-20 21:58:15 -07:00
Kartik K. Agaram a88d9c1907 remove a stray use of LÖVE Text objects 2023-04-22 22:30:25 -07:00
Kartik K. Agaram b138f1ff9b Merge template-live-editor 2023-04-16 11:30:56 -07:00