fgof-screen Public
Go to file
T
Code
Use Git or checkout with SVN using the web URL.
No matching headings.
fgof-screen
Virtual screen buffers and diff rendering helpers for modern Fortran.
fgof-screen is intended to be a small, standalone library for virtual screen
state, styled cells, and render-diff workflows that terminal apps keep
rebuilding from scratch.
It is part of the FortranGoingOnForty lib-modules
catalog, but it is intended to stand on its own as a normal fpm package.
Current v1 target:
- stable screen style, cell, size, and buffer types
- predictable virtual-grid allocation and fill helpers
- diffable screen-state model with damage tracking for future ANSI-first rendering
- room for a higher-level renderer without making ncurses the package identity
Future scope:
- optional adapter layers for alternate backends later
- examples and higher-level paint helpers
Status
Sprint 04 is in place.
Tracked today:
- package layout, CI, and standalone repo setup
- foundational screen types for styles, cells, sizes, and buffers
- virtual-grid allocation, resize, fill, and clear helpers
- explicit cell writes and cursor clamping helpers
- frame diff computation with changed-cell counts and damage bounds
- explicit size, cursor, and cursor-visibility change reporting
- ANSI full-frame rendering
- ANSI diff rendering driven by the damage model
- explicit cursor-state ANSI output
- tracked example programs for full-frame and diff rendering
- render-edge coverage for empty screens and cursor-only diffs
- full-frame ANSI output with explicit row addressing
- render-time sanitization for non-printable control glyphs
- CI on macOS and Ubuntu, including direct example execution
- row-first, column-second grid semantics pinned down in tests
- focused scaffold coverage in
fpm test
Public API Shape
Primary modules:
fgof_screenfgof_screen_types
Public types:
screen_stylescreen_cellscreen_sizescreen_bufferscreen_damagescreen_diff
Current public procedures:
clear_screen_styleclear_screen_cellclear_screen_damageclear_screen_diffclear_screen_sizeclear_screen_bufferallocate_screenresize_screenfill_screenclear_screendiff_screenput_cellput_glyphrender_cursor_ansirender_screen_ansirender_screen_diff_ansiset_cursor
Current semantics:
screen_buffer%cells(row, col)is the current virtual-grid layoutallocate_screen(width, height)allocates a blank grid for positive sizes- newly allocated cells start as blank-space cells with default style
resize_screen()preserves overlapping content, blanks newly grown cells, and clamps the cursor into boundsfill_screen()applies a glyph and optional style across the whole allocated bufferclear_screen()is the whole-buffer blank fill helperput_cell()andput_glyph()update a specific(row, col)location without transposing the grid model- out-of-bounds cell writes are ignored rather than clamped to another location
set_cursor()keeps cursor position within the allocated grid, or resets it to(1, 1)when the buffer is emptydiff_screen(previous, current)compares two virtual frames and reports cell damage separately from size or cursor changesscreen_diff%damageuses one bounding rectangle plus achanged_cellscount for the changed frame area- newly added or removed visible cells from resizes count as changed damage even when their glyphs are blank
render_screen_ansi()emits a whole-frame ANSI repaint with clear/home semantics, explicit row addressing, and final cursor restorationrender_screen_diff_ansi()emits a damage-scoped ANSI repaint and uses blank cells to erase removed content after shrinksrender_cursor_ansi()emits the final cursor move plus visibility state for a screen buffer- ANSI row rendering tracks style transitions explicitly and resets back to default style when needed
- ANSI renderers replace ASCII control glyphs with
?so screen cells cannot inject raw control bytes into the output stream
Build And Test
fpm test
Tracked examples:
Supported Platforms
- macOS
- Linux
Boundaries
- intended to stay independently versioned and releasable
- focused on virtual screen state first, not full terminal control yet
- should stay useful on its own even if future prompt or TUI packages build on top
License
MIT