github directvt/vtm v2026.04.16

9 hours ago

GitHub all current

Known Issues

  • References to deleted images from the scrollback are not removed. (fixed in cb895a7)
  • There is no way to do image inheritance and composition.

Changes

  • This release is not compatible with previous releases.
  • AnyPlex Protocol, (tracked in #902):
    • Change the way images are displayed. See the updated specification.
NormalizedSourceViewport6path

Attributes

Attribute Scope Value/Range Default Description
id - <id>[/sub-id] empty string ("") Object reference ID.
u, v Shared float 0.0 Top-left of the source crop (0.0-1.0).
uw, vh Shared float 1.0 Size of the source crop (0.0-1.0). Negative flips.
x, y Shared float 0.0 Offset of the Clipping Box inside the W x H area (cells).
w, h Shared float (0.0-65535.0] W, H Dimensions of the Clipping Box inside the W x H area (cells).
fit Shared inside|outside|stretch|none inside Fit logic: How the crop fits into the w x h Clipping Box. (none = exact pixels).
tr Shared 0..7 0 Transform: Decimal value of the 3-bit state [FlipY][FlipX][SwapXY].
rt Shared 0|90|180|270 0 Rotate: CCW rotation of the source (degrees).
f Shared n|v|h|vh|hv n Flip: n = none, v = vertical, h = horizontal.
a Shared [l|c|r][t|m|b] cm Align: 2D alignment within the Clipping Box and the W x H area. (l = left, c = center, r = right, t = top, m = middle, b = bottom).
o Shared 0|1 0 Ontop: 0 = under text, 1 = over text.
gc Unique string ASCII Space (0x20) " " Grapheme cluster to write to cells (will be scaled to a 1x1 cell size).
W, H Unique 0..65535 0 Grid Container: Physical footprint in cells. If 0, nothing is rendered (registration only).
r, c Unique 0..65535 0 Row, column 1-based slicing index for target cell slice. (0 = full height/width, 1..n = specific cell/slice).

Rendering & Interaction

  • Normalized Source Viewport: The source document is first projected onto a virtual canvas of size 1.0 by 1.0. A rectangular fragment (crop) is then extracted from this canvas using normalized coordinates u, v (top-left) and uw, vh (size), where 1.0 equals the full canvas dimension. Negative values for uw or vh cause the extracted fragment to be flipped along the respective axis.
  • Target Rectangular Area: The grid footprint is explicitly defined by the unique attributes W and H. The range of affected cell indices starts at the current cursor position and spans [0 .. W-1] horizontally and [0 .. H-1] vertically. If W or H is 0, no cells are modified, and the object is only registered in the cache.
  • Pixel-wise Precision:
    • Content Positioning: The image fragment is scaled according to fit and aligned within the Clipping Box (w x h) using the a attribute.
    • Box Positioning: This Clipping Box is then aligned within the Grid Container (W x H) using the same a attribute.
    • Offsets: Shared x and y values are applied as final pixel offsets from the resulting position.
    • Final Cut: The Grid Container acts as a strict physical mask; any pixels falling outside the W x H cell area are not rendered.
  • Persistence: Metadata (Object Reference + Unique attributes) is stored per-cell to survive scrollback and ensure logical linking for rectangular reflow, using only an implementation-defined minimum of data to minimize memory overhead.
  • Cursor Position: Anchored at the top-left; moves to the cell immediately following the bottom-right corner of the Grid Container (W x H) after output.
  • Destructivity:
    • If the gc attribute is not empty, the provided grapheme cluster is written to every cell in the target area, replacing existing text and SGR attributes.
    • If gc is empty, the output is non-destructive; existing text and SGR attributes remain visually intact.
    • Subsequent text written over the area does not destroy the underlying object. Metadata remains in the cell until explicitly replaced.
  • Selection & Highlighting: When a cell is selected (e.g., mouse selection or SGR 7), the frontend applies a 0.5 opacity mask to the object's pixels within that specific cell to ensure the selection remains visible.
  • Searchability: Any text contained within the document (e.g., <text> in SVG) is rendered as part of the graphic and is not indexed for terminal text search.
  • Layering & Transparency: Supports per-pixel alpha. The o(ontop) attribute determines Z-order:
    • 0: [Cell BG] -> [Object] -> [Text]
    • 1: [Cell BG] -> [Text] -> [Object]
    • The cell's background color always remains at the bottom. The terminal cursor is always drawn on top. Alpha blending should be performed in linear color space.
  • Foreground Color & Security: The underlying cell SGR foreground color maps to currentColor (for SVG). All external references (e.g., http://...) are ignored for security purposes.

Example

  • https://commons.wikimedia.org/wiki/File:Ghostscript_Tiger.svg
  • anyplex_test.ps1:
    "`e[H`e]app; gc='' id=tiger w=20 h=20 W=50 H=12 $(cat Ghostscript_Tiger.svg) f=h`a"
    while ($true)
    {
      for ($i = 0; $i -lt 40; $i++)
      {
          "`e[H`e]app;gc='' id=tiger x={0:N3} uw=$i f=n`a" -f (($i - 40) / 30)
          Start-Sleep -Milliseconds 10
      }
      for ($i = 39; $i -gt 0; $i--)
      {
          "`e[H`e]app;gc='' id=tiger x={0:N3} uw=$i f=h`a" -f ($i / 30)
          Start-Sleep -Milliseconds 10
      }
      for ($i = 0; $i -lt 40; $i++)
      {
          "`e[H`e]app;gc='' id=tiger x={0:N3} uw=0 f=n`a" -f ((-$i) / 30)
          Start-Sleep -Milliseconds 10
      }
    }

Don't miss a new vtm release

NewReleases is sending notifications on new releases.