ultraviolet 0.3.0
ultraviolet: ^0.3.0 copied to clipboard
Core cell/buffer/style types for terminal rendering.
Changelog #
0.3.0 #
Added #
- New
terminal_graphics.dartmodule exposes shared helpers for Kitty APC and Sixel DCS protocols:TerminalGraphicsControl,TerminalGraphicsFrame,TerminalGraphicsProtocol,parseTerminalGraphicsControls,mayContainTerminalGraphics,containsRetainedTerminalGraphics,containsSixelDisplay,suppressOverflowingTerminalGraphics,deleteAllRetainedGraphics, anddeleteRetainedGraphic. OwnedCellScreeninterface withsetCellOwnedallows callers to transfer ownership of freshly created cells without an extra clone.Buffer.createandScreenBufferaccepttracksDirty: falsefor offscreen composition buffers that do not need per-frame dirty-tracking bookkeeping.Canvasnow opts out of dirty tracking in its internalScreenBuffer.KittyImage.encode/encodePngacceptsuppressCursorMovement(defaulttrue), emittingC=1so retained-mode renderers control cursor state.KittyImageDrawableacceptsclearBeforeDraw: trueto emit a Kitty delete-placement sequence before drawing, preventing stale placements after a resize or move.SixelImageDrawableacceptsallowUpscale: falseto cap the Sixel raster at its native resolution instead of stretching to fill the cell area.SixelImage.encodeprefixes a raster-attributes header to declare a 1:1 pixel aspect ratio and encoded dimensions for correct rendering in foot and similar terminals.clampRgbChannelincolor_utils.dartclamps a color component to [0, 255].- Added
CanvasTerminalRendererfor browser/wasm rendering on an HTML canvas. - Added a web canvas example and demo page for exercising UV rendering outside native terminals.
Changed #
UvTerminalRendererdefers retained-graphics cells (KittyC=1) and Sixel display payloads to end-of-frame to avoid cursor-position conflicts with normal cell output. Retained cells are repositioned via cursor-movement sequences; Sixel payloads use absolute cursor positioning.UvTerminalRendererwraps graphics payloads in a tmux DCS passthrough whenTMUXis set orTERMstarts withtmux, allowing Kitty and Sixel sequences to pass through a tmux multiplexer.UvTerminalRenderercallserase()before rendering any frame that contains a Sixel display to prevent stale data from bleeding through.StyledString.drawnow treats Kitty APC (ESC _ G ... ESC \) and Sixel DCS (ESC P q ... ESC \) control strings as terminal-graphics payload cells with the correct display-column width derived from thec=parameter.Ansi.visibleLengthnow accounts for Kitty (c=) and Sixel (1 cell) display width instead of stripping them to zero.Ansi.expandTabsand CRLF normalization use early-exit fast paths when the input contains no tab or CR characters.- Truecolor SGR parameters are now clamped to [0, 255] across
style_ops,styled_string,ansi_slice,wrap, andterminal_rendererto prevent invalid CSI sequences from oversized or 16-bit color components. emojiPresentationWidthis now a settable property; updates also clear the unicode string-width cache to keep cached values consistent.- Unicode string widths are cached (up to 2048 entries, strings up to 4096 chars) to reduce repeated grapheme-cluster traversal on the same strings.
Rectangle.isEmptynow checks precomputed edges directly in hot render paths.- Split terminal, stdin, and window-size helpers across IO, web, and stub implementations so UV can be used from browser targets.
- Extracted the common terminal renderer abstraction from
UvTerminalRendererfor reuse by native and canvas-backed renderers.
Performance #
- Optimized packed cell construction for styled text and printable ASCII cells.
- Cached repeated style ids and ASCII scalar strings so Markdown-heavy render
paths avoid repeated packed-style encoding and
String.fromCharCodechurn. - Reduced offscreen composition overhead by using non-dirty-tracked buffers and updating line cells in place.
Fixed #
Cell._setStyleshort-circuits immediately for the zero style, skipping a redundant packed-key encode._LinkRegistry.interncaches the last interned link to avoid a map lookup on repeated calls with the sameLinkvalue._containsControlnow iterates code units instead of runes._widthBitswidened from 3 to 16 to support large terminal-graphics cell widths (e.g. an 80-column Kitty image) without overflow in pooled ids.Buffer.setCellskips compositing when the new cell is fully opaque.Buffer.fillAreaclips to the buffer bounds before iterating, preventing out-of-bounds dirty touches.Buffer.replaceWithClonecopies in-place viacopyFromand updates the render hash incrementally.Ansi.requestPrimaryDeviceAttributescorrected fromESC[?ctoESC[c.- Fixed web canvas background inheritance so selected rows, dominant backgrounds, default-background rows, and non-background cells bridge consistently during canvas rendering.
0.2.0 #
Changed #
Terminalstartup capability probing now queries DA2 as well as DA1, kitty keyboard, colors, and kitty graphics.Terminalstartup capability probing now queries DA3 and terminal-version reports alongside the existing DA1/DA2, kitty keyboard, color, and kitty-graphics probes.Terminalstartup capability probing now queries the terminal light/dark color-scheme report alongside the existing device, keyboard, graphics, and color probes.TerminalCapabilitiesnow tracks exact kitty keyboard enhancement flags plus foreground, background, cursor, and palette color reports with idempotent updates.TerminalCapabilitiesnow tracksModifyOtherKeysmode reports and terminal dark/light color-scheme state instead of treating those reports as transient decode-only events.Terminalstartup capability probing now queries foreground and cursor colors in addition to the existing background, keyboard, device-attribute, and kitty-graphics probes.TerminalCapabilitiesnow infers Kitty and iTerm2 image-protocol support from terminal-version replies in addition to the existing environment and device-attribute hints.
Fixed #
Terminalis now explicitly single-use afterstop(), repeated mode toggles are idempotent, and changing kitty keyboard enhancement flags now resets the old mode before applying the new one.- Added lifecycle coverage for kitty keyboard enhancement enable/disable behavior and shutdown cleanup in
Terminal. - Fixed capability state tracking so primary device attribute changes are detected even when Sixel support does not change, and repeated identical color/capability reports no longer churn state.
TerminalCapabilitiesnow stores and de-duplicates secondary device attributes instead of discarding DA2 reports after decode.TerminalCapabilitiesnow stores and de-duplicates DA3 tertiary attributes and terminal-version reports instead of discarding them after decode.- Added direct
Terminalcoverage for focus/blur events, bracketed paste events, and startup foreground/cursor color capability updates. - Added direct
Terminalcoverage for mouse click, release, motion, and wheel events plus standard and in-band resize report handling. - Added direct
Terminalcoverage for cursor-position, ModifyOtherKeys, and primary/secondary/tertiary device-attribute reports, including capability-state updates from DA1. - Added direct
Terminalcoverage for clipboard, terminal-version, XTGETTCAP, background-color, and palette report handling. - Fixed
UvTerminalRendererleading-blank overwrite fallback so it only emits blanks for truly blank old-line regions instead of using spaces to move across existing content.
0.1.1+1 #
- fix documentation + missing assets
0.1.1 #
Fixed #
- Updated package screenshots/readme media setup for pub.dev rendering.
- Added
pubspec.yamlscreenshot metadata (assets/layout.png) for package page preview.
0.1.0 #
Added #
- Initial release of
ultraviolet. - Core terminal rendering primitives: cells, buffers, styles, ANSI handling, and terminal renderer.
- Layout/rendering helpers and example suite for advanced terminal graphics.
Fixed #
- Synchronized-output skipped-frame behavior in
UvTerminalRendererdirty-line handling.