summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* docs: v0.4.0 changelog + demo GIFs (kitty + foot/sixel)v0.4.0cashmere2026-04-047-3/+69
| | | | | | Add CHANGELOG.org with full 0.4.0 release notes covering sixel support, text sizing protocol, agent-shell, and bug fixes. Replace demo GIFs with backend-specific showcases: kitty.gif (truecolor) and foot.gif (sixel).
* feat: add inline mpv video playback via Kitty graphics protocolcashmere2026-04-031-3/+253
| | | | | | | | | | | | | | Spawn mpv with --vo=kitty to paint video frames into a terminal region that Emacs controls. Emacs reserves overlay space and coordinates mpv's screen position via JSON IPC on scroll/resize. New public API: - kitty-gfx-play-video: play video file inline at point - kitty-gfx-stop-video: stop playback and cleanup - kitty-gfx-toggle-video: pause/resume Requires: mpv with --vo=kitty support, Kitty terminal. Gated behind kitty-gfx-enable-video defcustom (nil by default).
* fix: text sizing rendering — column guard, CPU optimization, preview modecashmere2026-04-021-52/+132
| | | | | | | | | | | | | | | | | | | | | | | | | Remove hardcoded column-1 guard that broke heading placement with display-line-numbers-mode and org-indent-mode. Headings were never placed (placed=0 hidden=37) because posn-at-point returns terminal columns offset by body-left, not buffer column 1. CPU optimizations reduce position queries by 86% and heading placements by 76%: - Early window-range exit skips posn-at-point for off-screen overlays - Emitted flag prevents redundant OSC 66 re-emission - Single fold-check instead of duplicate calls - Strip text properties to prevent org-modern payload corruption Add preview mode that temporarily disables conflicting minor modes (org-modern, org-appear, org-indent, visual-line, olivetti) and unfolds all headings for clean OSC 66 rendering. Modes are restored when heading sizes are toggled off. Add row-based collision detection to prevent overlapping multicell blocks when adjacent headings occupy the same terminal rows. Deferred display property shows heading text as fallback until first successful OSC 66 emission, preventing invisible headings.
* fix: Sixel backend parity improvementscashmere2026-03-291-5/+29
| | | | | | | | | | | | | | | | | | | Close gaps identified in Sixel vs Kitty audit: - image-mode: mode-name now shows Image[Sixel] or Image[Kitty] based on active backend (was hardcoded to Image[Kitty]) - LaTeX preview: docstring updated to reference kitty-graphics package name, not Kitty protocol specifically - sixel-cleanup-all: now erases visible Sixel images from terminal cells before cleaning disk/memory state (prevents pixel artifacts on mode disable) - sixel-place: LRU eviction for .six temp files, capped at kitty-gfx-cache-size (default 64), oldest evicted on overflow Remaining by-design differences (protocol limitations, not bugs): - Sixel re-emits raw pixel data on scroll (no placement IDs) - Sixel erases by overwriting with spaces (no protocol-level delete) - Sixel detection is env-var based (no DA1 query yet)
* fix: skip heading rendering when folded to same visual linecashmere2026-03-291-2/+9
| | | | | | | | | | | | | | | | | | | | 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)
* fix: use ECH erase + pre-erase pattern from mdfriedcashmere2026-03-291-13/+39
| | | | | | | | | | | | | | | | | Replace space-writing erase with ECH escape (\e[NX) which erases characters at the cursor without moving it — more efficient and cleaner terminal state. Changes: - kitty-gfx--erase-heading-at: new low-level function using ECH, disables DECAWM during erase to prevent wrapping artifacts, erases all rows of multicell blocks (not just topmost) - kitty-gfx--erase-heading: now delegates to erase-heading-at - kitty-gfx--place-heading: pre-erases target area before emitting OSC 66, preventing ghost artifacts from partial overwrites Adapted from mdfried's "erase-character dance" pattern which erases the full multicell area using ECH before every OSC 66 emission.
* docs: deep research on OSC 66 implementationscashmere2026-03-291-0/+236
| | | | | | | | | | | | | Comprehensive analysis of 5 OSC 66 implementations: - mdfried (Rust): erase-character dance, fractional scaling with s=2 base, unicode chunking for wide chars, bug history - neovim#32539: architecture analysis confirming our overlay approach - render-markdown.nvim#560: ecosystem blocked on neovim core - opentui (TS+Zig): separator convention, ST vs BEL terminator - foot!1927 (C): width-only impl, variation selector bugs Key actionable findings: ECH erase, s=2 fractional tiers, wide-char chunking, pre-erase before emission.
* chore: bump to 0.4.0, extend debug-state for headingscashmere2026-03-291-7/+16
| | | | | | | | - Version bump 0.3.0 → 0.4.0 (text sizing feature complete) - kitty-gfx-debug-state: show text-sizing-support status in header, distinguish heading vs image overlays, display heading-specific properties (text, scale, level, cell-s) instead of image properties (id, pid, file)
* feat: nuke-and-repaint for fold/unfold heading cleanupcashmere2026-03-291-10/+39
| | | | | | | | | | | | | | | | | | | Add heading-aware org-cycle handling: - kitty-gfx--nuke-headings: erases ALL heading multicell blocks in the current buffer, clearing their cached positions. This is the "nuke" phase — a clean slate for the terminal. - kitty-gfx--on-org-cycle: now handles both image and heading overlays. Images get their placements deleted (existing logic), headings get their multicell blocks erased (nuke phase). The subsequent scheduled refresh is the "repaint" phase: kitty-gfx--overlay-screen-pos checks in-folded-region-p, so folded headings return nil and won't be re-emitted, while visible headings get fresh OSC 66 emission at correct positions. The nuke-and-repaint strategy avoids incremental erase complexity (which failed in two prior prototypes) by simply erasing everything and letting the refresh cycle figure out what's still visible.
* 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 heading overlay creation and org-mode integrationcashmere2026-03-291-0/+208
| | | | | | | | | | | | | | | | | - Add kitty-gfx--make-heading-overlay with display property (spaces), after-string (vertical space), modification hooks, and full heading property schema - Add kitty-gfx--org-apply-heading-sizes to scan org headings and create scaled overlays from kitty-gfx-heading-scales alist - Add kitty-gfx-org-heading-sizes interactive toggle command - Add kitty-gfx--refresh-heading-overlay stub (position tracking only, no OSC 66 emission yet) - Dispatch heading vs image overlays in kitty-gfx--refresh-overlay - Add org-mode-hook for auto heading sizes (kitty-gfx-heading-sizes-auto) - Add heading rescan timer for debounced re-scan after edits - Forward-declare org-get-heading, org-link-display-format, org-current-level - Fix kitty-gfx--heading-sgr to handle undefined faces in batch mode - Add heading overlay self-tests (creation, properties, after-string)
* 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
* feat: add Sixel graphics backend with protocol auto-detectioncashmere2026-03-294-125/+1090
|\ | | | | | | | | | | | | | | | | | | | | - Introduce alist-based backend dispatch (kitty/sixel) - Add Sixel encoding via ImageMagick with temp-file cache - Auto-detect protocol: try Kitty first, then Sixel - Add kitty-gfx-preferred-protocol defcustom - Sixel erase via space-overwriting (stateless protocol) - Cleanup temp files on kill-emacs - Update README and AGENTS.md for multi-protocol support - Bump version to 0.3.0
| * 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.
| * docs: update AGENTS.md for Sixel backend architecturecashmere2026-03-201-0/+267
| | | | | | | | | | | | | | | | | | - Document backend dispatch system (alist-based, detect-protocol) - Update architecture section with Kitty vs Sixel pipeline - Add Sixel-compatible terminals to testing/dependencies - Note Sixel limitations (256 colors, stateless) - Track org-mode misplacement bug as WIP - Bump documented version to 0.3.0
| * docs: update README for Sixel backend and multi-protocol supportcashmere2026-03-201-29/+41
| | | | | | | | | | | | | | | | | | - Mention Kitty + Sixel in title and overview - List Sixel-compatible terminals (foot, Konsole, xterm, mlterm, mintty) - Document auto-detection order and kitty-gfx-preferred-protocol defcustom - Simplify installation guard to (not (display-graphic-p)) - Add backend-specific sections to How It Works - Update Known Limitations for both protocols
| * 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.
| * docs: add Sixel expansion plan from CEO-mode reviewcashmere2026-03-201-0/+298
|/ | | | | | | Complete architecture review for adding Sixel graphics protocol support. Documents all key decisions: alist backend dispatch, temp-file cache, dirty-flag refresh, sync encoding with debounce. Estimated 3-5 days, +300-400 LOC, unlocking ~20 additional terminals including tmux.
* Merge pull request #3 from Lenbok/agent-shell-supportcashmeredev2026-03-171-0/+46
|\ | | | | feat: support images in agent-shell sessions
| * 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
* docs: update README with LaTeX preview, doc-view, zoom, new defaultscashmere2026-02-261-6/+16
| | | | | | | | | | - Add org LaTeX preview and doc-view to integrations list - Add usage instructions for LaTeX (C-c C-x C-l) and doc-view (n/p navigation, +/-/0 zoom) - Update customization table: max-width 120, max-height 40 - Add LaTeX (texlive+dvipng) and doc-view (ghostscript) to requirements - Note doc-view centering flash as known limitation
* 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-262-1/+92
| | | | | | | | | | | | | 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
* chore: move test files to tests/ and add dev environmentcashmere2026-02-265-0/+4
| | | | | | | - Move test-image.png, test-kitty-gfx.org to tests/ - Add test-document.pdf (3-page PDF for doc-view testing) - Add .envrc for nix flake dev environment - Update .gitignore (ltximg/, Emacs lock files, AGENTS.md)
* Add demo filescashmere2026-02-245-0/+36
|
* feat: Add README.org and kitty-graphics.elcashmere2026-02-242-22/+30
|
* Add cell size query, synchronized output, and dirvish integrationcashmere2026-02-242-74/+242
| | | | | | | | | | | | | - 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-243-0/+821
| | | | | | 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.
* initcashmere2026-02-231-0/+0