flterm 0.0.6
flterm: ^0.0.6 copied to clipboard
Flutter terminal widget on top of Ghostty's libghostty-vt engine.
Changelog #
0.0.6 #
Breaking #
- Scrollback limits: replace
TerminalConfig.scrollbackLimitwithscrollbackMaxBytesand optionalscrollbackMaxLines. The default byte limit changes from 10,000,000 to 10,000. SetscrollbackMaxBytes: 10_000_000to preserve the previous budget, or use null for no byte limit. - Controller extensibility:
TerminalControlleris sealed. Create sessions through its factories and use composition instead of custom subclasses or implementations. - Focus and keyboard control: controller focus methods, keyboard methods,
and
keyboardStateare removed. Pass aFocusNodetoTerminalViewfor imperative focus control and configure soft-keyboard access withTerminalView.showKeyboard. - Controller contract:
TerminalControllersupports one attachedTerminalView. A second concurrent attachment throwsStateError. - Callback configuration:
onBell,onOutput,onPwdChanged,onResize, andonTitleChangedare setter-only. Retain callback references if their identity is needed elsewhere. - Clipboard payloads: re-exported
ClipboardContentandClipboardWriteare immutable classes. Replace record literals with their constructors and use named fields. - Removed public types:
KeyboardStateandTerminalScrollPositionare no longer exported. UseFocusNode,TerminalView.showKeyboard, and the standardScrollPositioninterface.
Added #
- Terminal snapshots:
TerminalController.snapshot()captures libghostty state, andTerminalController.fromSnapshot()restores it progressively or synchronously.restorationexposes lifecycle state, while therestoredfuture reports completion and late errors. Continuation tracking preserves incomplete VT and UTF-8 input. Restoration can compress history, preserve snapshot colors, and defer resizing while scrollback loads. - Terminal search:
TerminalController.searchmanages incremental searches, match navigation, scroll policy, and automatic viewport highlighting.TerminalTheme.searchstyles ordinary and selected matches, whileTerminalView.overlayBuilderandTerminalViewGeometrysupport custom, cell-aware search interfaces. - Touch selection handles: Android and iOS long-press selections expose
draggable platform-styled endpoint handles with adaptive magnifiers and edge
autoscroll. Toggling the configured block-selection modifier while dragging
switches between normal and rectangular selection. Configure or disable
magnification through
TerminalGestureSettings. - Clipboard reads:
TerminalController.onClipboardReadforwards MIME-aware terminal requests for application-controlled clipboard access. - Session events: callbacks expose desktop notifications, progress, program status, semantic prompts, full resets, and unknown sequences.
- Terminal metadata: controllers expose memory usage and requested mouse shapes; views reflect terminal-requested pointer shapes.
- Prompt navigation:
TerminalController.scrollToPrompt()navigates between shell integration prompts. - Resource controls: applications can limit retained snapshot continuation bytes, captured unknown sequences, and clipboard-write payloads.
- Terminal compatibility: disable restoring scrollback rows during resize for backends that keep their own screen buffer, or opt into screen checksum replies for terminal programs that need them.
Changed #
- Synchronized output: views hold complete frames during terminal-driven synchronized updates, including cursor and image state. A timeout releases abandoned holds, and user interactions release a hold when needed.
- Rendering memory: font and glyph caches have bounded memory use across terminal views.
- Resize lifecycle:
onResizereports only afterTerminalViewcommits a measured grid; assigning it later immediately reports that grid. Cell-pixel-only changes skip the callback, and in-band output is emitted first.
Fixed #
- Ctrl+Space: the chord encodes as NUL in legacy mode and as a Kitty CSI u chord, allowing applications such as Neovim to receive it.
- Cursor rendering: the cursor and composing text no longer appear at an invalid viewport position. The cursor follows the terminal's reported style.
- Text input recovery: keyboard input resumes after another widget takes the platform text input connection, including during IME composition.
- Keyboard and IME input: AltGr text no longer sends unintended Control or Alt input. Kitty keyboard reports include Caps Lock and Num Lock, and IME newline and deletion events no longer duplicate or suppress input.
- Pointer input: mouse and stylus button changes remain accurate during a gesture, stylus drags select text, and a gesture no longer switches between selection and terminal mouse reporting.
- View updates: replacing a controller preserves terminal focus, and
detached controllers can be attached again. Changing
TerminalView.fontDataupdates text sizing. Selection changes no longer cause notifications during widget builds. - Terminal glyph rendering: Nerd Font symbols use common fallback families, fit their cell without distortion, and preserve adjacent spacing. Operator ligatures remain stable across complete runs, and glyphs that extend beyond their cells retain their visible overflow.
- Kitty graphics: images no longer disappear or briefly show mismatched pixels and dimensions during replacement. Image placements stay aligned after layout changes and resizing.
0.0.5 #
Added #
- Clipboard writes:
TerminalController.onClipboardWriteforwards atomic, binary-safe OSC 52 and iTerm2 clipboard requests so applications can apply their own platform and security policies. If the callback throws, the initiating write finishes terminal processing before rethrowing the error. - Idle scrollback compression: attached terminal views schedule bounded compression after terminal and viewport activity settles, reducing retained scrollback memory without competing with rendering.
Changed #
- Kitty graphics caching: unchanged placement snapshots are reused across frames, while image generations invalidate cached images and stale pending decodes. This avoids repeated traversal, sorting, and eviction work without displaying stale image data.
- Color behavior:
ColorPalette.generated()uses libghostty palette generation, and terminal color-scheme reports use perceived background luminance. - Published package contents: tests, benchmark tooling, generated API documentation, build outputs, and coverage data are excluded.
Fixed #
- IME preedit layout: ZWJ emoji, skin-tone emoji sequences, combining marks, and variation selectors are measured as grapheme clusters using libghostty's terminal width rules.
- Viewport scrolling: scroll-controller pixel offsets map to absolute terminal rows regardless of the current viewport position.
- Windows text input: platform text input binds to the
TerminalView's owning Flutter view and reconnects when that view changes.
0.0.4 #
Breaking #
- Selection APIs: selection is backed by libghostty.
TerminalSelectionandTerminalSelectionModeare removed,TerminalConfig.wordPatternmoves toTerminalGestureSettings.wordBoundaries, and gesture toggles are explicit settings.
Added #
- Terminal links:
TerminalView.linkSettingsdetects OSC 8 links, text URLs, file paths, and custom regex links. - Controller APIs:
selectRange,hasSelection,pwd, andonPwdChangedexpose selection and working-directory state. - Glyph Protocol:
TerminalConfig.glyphProtocoltoggles Glyph Protocol APC handling.
Changed #
- Rendering pipeline: selection, cursor viewport state, and cell metadata use refreshed libghostty render snapshots.
0.0.3 #
Breaking #
- Flutter SDK floor: requires Dart 3.12 and Flutter 3.44.
Added #
- IME composition: composing text appears at the terminal cursor and works with platform text input.
- Sprite glyph rendering: box drawing, block elements, Braille, Powerline, geometric shapes, and legacy computing glyphs render with built-in glyphs.
- Shared render caches:
TerminalScopelets multiple terminal views share compatible rendering resources. - APC buffer limits:
TerminalConfig.apcBufferLimitcontrols how much APC payload data the terminal accepts.
Changed #
- Rendering pipeline: terminal frames share rendering caches and do less repeated work between frames.
Fixed #
- Keyboard input: shifted printable keys and IME editing produce the expected terminal text.
- Rendering accuracy: erased backgrounds, cursor shape, cell metrics, and sprite glyphs render more consistently.
0.0.2 #
Breaking #
- Theme colors move into
ColorPalette:TerminalThemeno longer takesbackground,foreground, andansiColorsdirectly. Build aColorPaletteonce and pass it in, so palettes are something you can share, swap, orcopyWithon their own. - Cursor and selection colors can adapt to the cell under them: the
color fields take
DynamicColor?now. UseDynamicColor.cellForeground()/.cellBackground()to follow the cell, orDynamicColor.fixed(c)for the old static behavior. selectedTextis a method: callcontroller.selectedText()for plain text, or pass aFormatterFormatto get VT or HTML for rich-clipboard copy.- Bold no longer switches to the bright palette by default: expect
slightly different bold colors; set
boldIsBright: trueto restore the old behavior.
Added #
- Kitty graphics: programs that emit images (previewers, image
viewers, some editors) render inside the widget. Cap the cache via
TerminalConfig.kittyImageStorageLimit; zero disables. - Transparent background:
TerminalTheme.backgroundOpacitymakes the default background translucent so the terminal can compose over a translucent window or other widgets.backgroundOpacityCellsextends it to cells with their own bg color. - More theme knobs:
CursorTheme.text(glyph color under a block cursor),TerminalTheme.boldColor(forced bold color), andSelectionTheme.foreground(selected-glyph tint). ColorPalette.generated(): derives indices 16–255 from your base 16 plus background and foreground so the extended palette blends instead of clashing with the fixed xterm cube.
Changed #
- Dirty-row rendering: frames rebuild only rows that changed, so idle terminals cost much less CPU.
0.0.1 #
Initial release.
Added #
TerminalView: a Flutter widget that renders a terminal and adapts its input to the host. Mouse and keyboard on desktop, touch and soft keyboard on mobile, both on web.TerminalController: owns the terminal and bridges it with the view. Connects to a backend (PTY, SSH, socket) viaonOutput,onResize,onBell, andonTitleChanged. Exposes I/O (write,sendText,sendKey), selection (selectAll,selectWord,selectLine), focus, scrolling, paste, clear, and mode toggling.- Themes: ANSI 16, 256-color, and truecolor palettes; cursor
shape, color, and blink; hyperlink style; font family, size, and
fallback; minimum contrast. Immutable and
lerp-able. - Wide characters: CJK, color emoji, VS16, and combining marks render correctly; selection snaps to whole cells.
- Mouse selection: drag, double-click word, triple-click line,
and Alt+drag block. Configurable via
TerminalGestureSettings. - Shortcuts: built-in copy, paste, select all, and clear with
platform-aware defaults (Cmd on macOS/iOS, Ctrl+Shift on
Linux/Windows). Extend or replace with any Flutter
Intent. - OSC 8 hyperlinks: idle and highlighted styles with click hit-testing.
- Cross-platform: Android, iOS, Linux, macOS, Web (WASM), Windows.