summaryrefslogtreecommitdiff
path: root/kitty-graphics.el
diff options
context:
space:
mode:
authorcashmere <cashmere@autistici.org>2026-03-29 08:39:08 +0200
committercashmere <cashmere@autistici.org>2026-03-29 08:39:08 +0200
commit97f0dbc31d9e7eed6ac3ae3300968a3d231270fe (patch)
tree6d592a74709c5cebf9e8ee813f4d3f27be8711d6 /kitty-graphics.el
parent11da531e49fca10ac7dab149ac9790d0c5e76bb9 (diff)
downloadkitty-graphics-97f0dbc31d9e7eed6ac3ae3300968a3d231270fe.tar.gz
fix: skip heading rendering when folded to same visual line
When org folds headings (S-TAB overview mode), the newline after each heading becomes invisible, causing multiple headings to appear on the same visual line. posn-at-point then reports col > 1 for headings that follow the fold ellipsis of a previous heading. Placing scaled text at col > 1 causes horizontal drift — headings rendered mid-line overlapping with fold ellipsis and each other. Fix: org headings always start at buffer column 0. If the computed terminal column is not 1, the heading is in a folded context where rendering at scale would be wrong. Skip it (treat as not visible), erase any previous placement, and let the refresh cycle re-place it when unfolded. Root cause identified via debug log analysis showing: Before fold: all headings at col=1 (correct) After S-TAB: headings at col=21/24 on same row (wrong)
Diffstat (limited to 'kitty-graphics.el')
-rw-r--r--kitty-graphics.el11
1 files changed, 9 insertions, 2 deletions
diff --git a/kitty-graphics.el b/kitty-graphics.el
index 845c756..60a1e70 100644
--- a/kitty-graphics.el
+++ b/kitty-graphics.el
@@ -1271,8 +1271,15 @@ avoid posn-at-point redraws destroying freshly-placed blocks."
(last-col (overlay-get ov 'kitty-gfx-last-col)))
(if (and pos
(<= (car pos) win-bottom)
- (<= (+ (car pos) rows -1) win-bottom))
- ;; Visible — erase old position if moved, cache new position
+ (<= (+ (car pos) rows -1) win-bottom)
+ ;; Guard: org headings always start at column 1 (buffer
+ ;; line beginning). If posn-at-point reports col > 1,
+ ;; the heading is visually mid-line due to org fold
+ ;; collapsing newlines between headings (S-TAB overview
+ ;; mode). Skip rendering — placing a scaled heading
+ ;; mid-line overlaps with fold ellipsis and other headings.
+ (= (cdr pos) 1))
+ ;; Visible at column 1 — erase old position if moved, cache new
(let ((new-row (car pos))
(new-col (cdr pos)))
(when (and last-row