summaryrefslogtreecommitdiff
path: root/kitty-graphics.el
Commit message (Collapse)AuthorAgeFilesLines
* feat: heading-aware scroll and buffer-change handlingcashmere2026-03-291-10/+26
| | | | | | | | | | | | | | | | | | Fix scroll/buffer-switch behavior for heading overlays: - on-window-change: preserve heading overlay position caches (images clear theirs for re-placement, but headings need old→new comparison to erase multicell blocks properly) - on-buffer-change: erase heading multicell blocks when their buffer becomes hidden, preventing ghost artifacts if the new buffer's content doesn't fully overwrite the heading cells - on-buffer-change: preserve heading caches for visible buffers (same rationale as on-window-change) The existing two-phase refresh already handles scroll correctly: phase 1 detects position changes and erases moved headings, phase 2 re-emits all visible headings. These fixes ensure the cache state is correct for that comparison to work.
* feat: emit OSC 66 for heading overlayscashmere2026-03-291-5/+325
| | | | | | | | | | | | | | | | | | | | | | | Add the OSC 66 emission pipeline (Step 5 of incremental plan): - kitty-gfx--place-heading: emits \e]66;s=S:n=N:d=D;TEXT\a with SGR bold + 24-bit foreground color at cached terminal position - kitty-gfx--erase-heading: erases multicell blocks by writing spaces at the topmost row (overwrite Rules 2-3) - kitty-gfx--refresh-heading-overlay: phase 1 computes position, erases on move/hide, caches new position (no emission) - kitty-gfx--emit-heading-overlays: phase 2 walks all buffers, emits OSC 66 for visible heading overlays after all posn-at-point queries complete (prevents redraw-induced multicell destruction) Two-phase refresh in kitty-gfx--refresh: phase 1 (walk-windows) does position queries and image placements, phase 2 (after loop) emits all heading OSC 66 sequences. Both phases run inside synchronized output (BSU/ESU) to prevent flicker. Also adds org-mode integration hooks (heading-modified debounce, org-mode-hook for auto-apply, heading scan/remove commands) and self-tests for place-heading and erase-heading in dry-run mode.
* feat: add OSC 66 text sizing protocol detectioncashmere2026-03-291-5/+95
| | | | | | | | | | - Add kitty-gfx--query-text-sizing-support using CPR probing (3 cursor position reports interleaved with OSC 66 tests) - Detect scale, width-only, or no support - Wire detection into kitty-graphics-mode enable (Kitty backend only) - Reset detection cache on mode disable - Update modeline lighter: KittyGfx[K+T] when text sizing available - Update enable message to mention text sizing when detected
* feat: add dry-run mode, scale decomposition, and self-test infrastructurecashmere2026-03-291-26/+173
| | | | | | | | | | | | | - Add kitty-gfx--dry-run variable and kitty-gfx--terminal-send wrapper that routes all terminal escape output through a single function, logging sequences in dry-run mode for batch debugging - Replace 9 bare send-string-to-terminal call sites with wrapper - Add kitty-gfx--decompose-scale for OSC 66 parameter computation - Add kitty-gfx--validate-osc66 for protocol param validation - Add kitty-gfx--heading-sgr for org-level-N face color extraction - Add kitty-gfx-run-self-tests with 15+ assertions for batch testing - Add kitty-gfx-heading-scales and kitty-gfx-heading-sizes-auto defcustoms - Add kitty-gfx--text-sizing-support state variable
* fix: force redisplay before position queries to fix initial image placementcashmere2026-03-201-39/+163
| | | | | | | | | | | | | | After org-toggle-inline-images creates overlays with multi-line display properties, posn-at-point still sees pre-overlay layout because Emacs hasn't recomputed pixel positions yet. This caused images to appear ~4 rows too low on initial render (scrolling would fix it). Adding (redisplay t) at the start of kitty-gfx--refresh forces a full layout recomputation so position queries return correct values immediately. Also includes: simplified column calculation using window-body-edges, stderr suppression in call-process, debug state inspection commands, and ImageMagick binary preference fixes.
* chore: bump version to 0.3.0cashmere2026-03-201-1/+1
| | | | | Sixel backend support is a new minor feature (new protocol, new terminals supported, new defcustom). No breaking changes to public API.
* feat: add Sixel graphics backend with protocol auto-detectioncashmere2026-03-201-65/+329
| | | | | | | | | | | | | | | | | | | Introduce backend dispatch architecture so the package supports multiple terminal graphics protocols. Existing Kitty protocol code is extracted into a `kitty` backend; a new `sixel` backend enables ~20 additional terminals (foot, Konsole, xterm, mlterm, mintty, VS Code Terminal). Key changes: - Alist-based backend dispatch (`kitty-gfx--backends`, `kitty-gfx--backend-fn`) - Kitty backend: detect/prepare/place/delete/cleanup extracted from inline code - Sixel backend: ImageMagick-based encoding, temp-file cache, DCS emission - Auto-detection (`kitty-gfx--detect-protocol`): tries Kitty first, then Sixel - `kitty-gfx-preferred-protocol` defcustom for user override (auto/kitty/sixel) - Mode-line indicator shows active backend: [K], [S], or [?] - Fix obsolete `when-let` → `when-let*` (zero byte-compile warnings) All integration points (org, image-mode, shr, dired, doc-view) dispatch through the backend interface — no mode-specific changes needed.
* feat: support images in agent-shell sessionsLenbok2026-03-121-0/+46
|
* fix: reuse placement ID on zoom to avoid WezTerm visual glitchescashmere2026-03-101-34/+55
| | | | | | | | | | | When zooming in image-mode or doc-view, reuse the existing placement ID instead of deleting and re-placing. This lets the terminal atomically replace the old placement (same PID, new dimensions) without a delete step, working around WezTerm rendering artifacts (wezterm#5892). Kitty handles this perfectly. WezTerm still shows minor artifacts on zoom-in (larger replacement) but zoom-out is clean. This is a WezTerm-side bug.
* feat: robustness overhaul — LRU cache, better error handling, reduced flickerv0.2.1cashmere2026-02-271-202/+494
| | | | | | | | | | | | | | | | | - LRU image cache with configurable size and eviction (kitty-gfx-cache-size) - Cache stores only image IDs; dimensions computed fresh each time - Leading-edge debounce for faster initial refresh response - Targeted placement deletion on buffer/window change (no more delete-all flicker) - Cell pixel size re-queried on window resize - Image overflow check prevents visual corruption at window bottom - convert-to-png returns nil on failure instead of passing non-PNG data - unwind-protect for temp file cleanup in display-image paths - kill-buffer-hook checks cross-buffer image sharing before deleting - ignore-errors around all send-string-to-terminal calls - Millisecond-precision debug logging throughout - Dead overlay pruning in refresh cycle - GIF removed from supported formats (multi-frame issues) - Window-size-change hook in image-mode for split/unsplit re-render
* chore: update URL to GitHub repositorycashmere2026-02-271-1/+1
|
* fix: image-mode compatibility with evil-mode and centered image positioningcashmere2026-02-261-8/+42
| | | | | | | | | | | | - Use kitty-gfx-image-mode major-mode to avoid evil-collection overriding zoom keybindings with native image functions that fail in terminal - Add evil normal-state bindings for +/=/-/0/q when evil is loaded - Use special-mode-map as parent instead of image-mode-map to prevent image-mode-window-put and image--change-size errors - Fix centered image column calculation: detect when posn-col-row is inflated by overlay display properties and fall back to body-left - Clear buffer-modified-p after image-mode renders - Add debug logging to centered display and image-mode-render paths
* feat: add image-mode centering and zoom controlscashmere2026-02-261-6/+43
| | | | | | | | | | | | Images in image-mode now display centered in the window with +/-/0 keybindings for zoom in/out/reset. - Add kitty-gfx--image-scale buffer-local variable - Add kitty-gfx--image-mode-render for centered display at scale - Add kitty-gfx-image-increase-size (1.25x per press) - Add kitty-gfx-image-decrease-size (0.8x per press) - Add kitty-gfx-image-reset-size (back to 1.0) - Bind +/-/0 in the image-mode keymap
* feat: add doc-view integration for PDF viewing with zoomcashmere2026-02-261-0/+91
| | | | | | | | | | | | | PDFs now render via Kitty graphics in terminal doc-view-mode. Pages display centered in the window with n/p navigation and +/-/0 zoom controls. - Advise doc-view-mode-p to bypass display-graphic-p guard while preserving per-type tool availability checks - Advise doc-view-insert-image to render pages via Kitty using the centered display helper with zoom scale - Advise doc-view-enlarge and doc-view-scale-reset to update the buffer-local scale factor and re-render
* feat: add centered display helper, bump default sizes, relax refreshcashmere2026-02-261-6/+53
| | | | | | | | - Add kitty-gfx--display-image-centered: centers images in the window with optional zoom scale parameter for full-window modes - Bump kitty-gfx-max-width 80->120, kitty-gfx-max-height 24->40 - Relax refresh visibility check to only require overlay start on screen (allows images larger than window for zoom-in)
* feat: add LaTeX fragment preview in org-mode via Kitty graphicscashmere2026-02-261-1/+80
| | | | | | | | | | | | | C-c C-x C-l now renders LaTeX fragments as images in terminal Emacs. Bypasses org's display-graphic-p guard since the latex+dvipng pipeline works fine without a GUI. - Advise org-latex-preview to handle terminal color fallbacks (unspecified-fg -> Black) and suppress clear-image-cache - Advise org--make-preview-overlay to display generated PNGs via kitty-gfx-display-image instead of Emacs image specs - Add kitty-gfx--org-clear-latex-preview for C-u cleanup - Add LaTeX test fragments to test-kitty-gfx.org
* fix: hide images when org headings are collapsedcashmere2026-02-261-3/+53
| | | | | | | | | | | | Add fold-aware visibility detection so images disappear when their containing heading is folded and reappear when expanded. - Add kitty-gfx--in-folded-region-p: checks org-fold (9.6+) then falls back to overlay-based invisibility, ignoring cosmetic org-link bracket hiding - Update kitty-gfx--overlay-screen-pos to skip folded overlays - Add kitty-gfx--on-org-cycle hook: deletes terminal placements before clearing cache, then schedules refresh
* feat: Add README.org and kitty-graphics.elcashmere2026-02-241-1/+1
|
* Add cell size query, synchronized output, and dirvish integrationcashmere2026-02-241-67/+218
| | | | | | | | | | | | | - Query terminal cell size via CSI 16t (XTWINOPS) instead of hardcoded 8x16 fallback, giving accurate image aspect ratios - Wrap all placement output in synchronized output (DEC mode 2026) to eliminate flicker during scroll and redisplay - Add native dirvish preview dispatcher (kitty-image) that hooks into dirvish-preview-dispatchers for automatic image preview - Improve shr/eww advice to detect actual image type from spec - Extract kitty-gfx--refresh-overlay for cleaner refresh cycle - Reset position cache on buffer/window change so images re-place after d=a - Bump version to 0.2.0, update package metadata and README
* Add dired preview command and improve image-mode integrationcashmere2026-02-241-2/+44
| | | | | | - kitty-gfx-dired-preview: preview images in a side window from dired - image-mode: add q to quit, set buffer-read-only - Add dired-get-file-for-visit forward declaration
* Initial commit: kitty-graphics.elcashmere2026-02-241-0/+722
Display images in terminal Emacs via Kitty graphics protocol with direct placements. Integrates with org-mode (including org-link-preview for org 10.0+), image-mode, and shr/eww.