fix: org tangle — fix END_SRC boundaries in mouse.org/slot.org (prose inside code blocks), replace emacs tangle with Python script that handles all blocks
This commit is contained in:
@@ -528,6 +528,26 @@ they are truncated with an ellipsis.
|
||||
(values)))
|
||||
#+END_SRC
|
||||
|
||||
** Bug Fixes (v1.0.0): scroll offset and scrollbar position
|
||||
|
||||
Two bugs were fixed in the ScrollBox render pipeline:
|
||||
|
||||
1. *Render scroll origin*: The render method used ~orig-y~ (the child's original
|
||||
layout-node Y position, always 0 for top-level children) as the basis for
|
||||
scroll offset. This caused the content-relative position ~vy~ to be ignored,
|
||||
making scroll offsets incorrect when children were offset by layout.
|
||||
|
||||
Fix: Use ~vy~ (the content-relative Y accumulator) instead of ~orig-y~ when
|
||||
setting the temporary layout offset: ~(layout-node-y cln) (- vy sy)~.
|
||||
|
||||
2. *Scrollbar positions*: ~draw-scrollbars~ drew scrollbars at viewport-local
|
||||
coordinates (0, 0), not accounting for the scrollbox's own position within
|
||||
the layout tree. Scrollbars would appear at the wrong screen location when
|
||||
the scrollbox was nested inside other containers.
|
||||
|
||||
Fix: Read the scrollbox's layout-node origin ~(ox, oy)~ and offset all
|
||||
scrollbar drawing coordinates by those values.
|
||||
|
||||
** Combined tangle blocks
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/scrollbox.lisp
|
||||
@@ -585,14 +605,14 @@ Children outside the viewport are skipped."
|
||||
(ch (if cln (layout-node-height cln) 1))
|
||||
(cy vy))
|
||||
;; Only render children that are visible in the viewport
|
||||
(when (and (< (+ cy (- sy)) (+ vh vy))
|
||||
(> (+ cy (- sy) ch) vy))
|
||||
(when (and (< (- cy sy) vh)
|
||||
(> (+ (- cy sy) ch) 0))
|
||||
;; Temporarily offset child's layout-node position for rendering
|
||||
(let ((orig-x (if cln (layout-node-x cln) 0))
|
||||
(orig-y (if cln (layout-node-y cln) 0)))
|
||||
(when cln
|
||||
(setf (layout-node-x cln) (- orig-x sx)
|
||||
(layout-node-y cln) (- orig-y sy)))
|
||||
(setf (layout-node-x cln) (- vx sx)
|
||||
(layout-node-y cln) (- vy sy)))
|
||||
(unwind-protect
|
||||
(render child backend)
|
||||
(when cln
|
||||
@@ -606,17 +626,20 @@ Children outside the viewport are skipped."
|
||||
|
||||
(defun draw-scrollbars (sb backend viewport-w viewport-h)
|
||||
(let* ((content-h (scroll-box-content-height sb)) (content-w (scroll-box-content-width sb))
|
||||
(sy (scroll-box-scroll-y sb)) (sx (scroll-box-scroll-x sb)))
|
||||
(sy (scroll-box-scroll-y sb)) (sx (scroll-box-scroll-x sb))
|
||||
(ln (scroll-box-layout-node sb))
|
||||
(ox (if ln (layout-node-x ln) 0))
|
||||
(oy (if ln (layout-node-y ln) 0)))
|
||||
(when (> content-h viewport-h)
|
||||
(let* ((thumb (scrollbar-thumb sy viewport-h content-h))
|
||||
(thumb-pos (round (* thumb viewport-h))))
|
||||
(draw-rect backend (1- viewport-w) 0 1 viewport-h :bg :bright-black)
|
||||
(draw-text backend (1- viewport-w) thumb-pos "█" nil nil)))
|
||||
(draw-rect backend (+ ox (1- viewport-w)) oy 1 viewport-h :bg :bright-black)
|
||||
(draw-text backend (+ ox (1- viewport-w)) (+ oy thumb-pos) "█" nil nil)))
|
||||
(when (> content-w viewport-w)
|
||||
(let* ((thumb (scrollbar-thumb sx viewport-w content-w))
|
||||
(thumb-pos (round (* thumb viewport-w))))
|
||||
(draw-rect backend 0 (1- viewport-h) viewport-w 1 :bg :bright-black)
|
||||
(draw-text backend thumb-pos (1- viewport-h) "█" nil nil)))))
|
||||
(draw-rect backend ox (+ oy (1- viewport-h)) viewport-w 1 :bg :bright-black)
|
||||
(draw-text backend (+ ox thumb-pos) (+ oy (1- viewport-h)) "█" nil nil)))))
|
||||
|
||||
(defun update-sticky-scroll (sb)
|
||||
(when (sticky-scroll-p sb)
|
||||
|
||||
Reference in New Issue
Block a user