A modernized port of the Free Vision (FV) text-mode UI framework from Free Pascal to modern Delphi (12+).
Free Vision is a classic console-based GUI toolkit originally derived from Borland's Turbo Vision. This modern variant uses Delphi CLASS syntax instead of the legacy Turbo Pascal OBJECT syntax, providing better IDE integration, proper inheritance, and modern memory management.
IFVDrawable, ISerializable), RTL generics (TObjectList<T>, TStringList)TDrawCell-based drawing systemFVProfile probes VT support, color depth (no-color / 16 / 256 / 24-bit), interactivity, CI environment, hyperlink + Sixel support; NO_COLOR and CLICOLOR_FORCE honored. FVScreen.UpdateScreen downsamples 24-bit RGB to the host's color system.FVUnicodeWidth provides correct wide / combining / zero-width measurement for emoji, CJK, ZWJ joiners, and variation selectors.ISerializable for state persistenceSIXEL support is optimized for Windows Terminal sessions and integrates with the normal Free Vision view system.
TSixelEncoder (src/SixelEncoder.pas): converts TPixelGrid data ($00RRGGBB) to SIXEL DCS strings using adaptive palette quantization (up to 256 registers)TSixelView (src/SixelView.pas): renders pre-encoded SIXEL data from memory or .sixel/.six/.sxl filesTSixelCanvasView (src/SixelView.pas): direct pixel drawing API for generated/animated graphics (SetPixel, FillRect, DrawLine, Clear)TImageWindow/TImageView (src/ImageView.pas): loads both BMP and SIXEL files, supports scrolling and safe viewport cropping before SIXEL encodingWindows Terminal supports true-color text attributes, but SIXEL itself remains palette-based.
Practical limit is still 256 color registers per emitted SIXEL image, so quality depends on quantization and dithering choices.
TSixelEncoder supports error-diffusion dithering to reduce visible color banding:
FV_SIXEL_DITHER=1 (also accepts on, true)FV_SIXEL_DITHER=0 (also accepts off, false)If terminal pixel cell detection is wrong, you can override with:
FV_CELL_W=<pixels>FV_CELL_H=<pixels>Test -> New Components contains:
Image Viewer (BMP + SIXEL files)SIXEL Spectrometer (direct animated bar rendering on TSixelCanvasView)SIXEL Animated Sine (direct animated waveform drawing on TSixelCanvasView)System clipboard support is provided by src/FVClipboard.pas and is shared across editor-style controls.
| Function | Description |
|---|---|
ClipboardSetText(const Text: string): Boolean | Writes Unicode text to Windows clipboard |
ClipboardGetText: string | Reads text from Windows clipboard |
ClipboardHasText: Boolean | Returns whether text data is available |
Ctrl+Ins: copy selectionShift+Ins: paste clipboard textThe Test menu includes clipboard-focused examples:
Test -> Editor -> ClipboardTest -> New Components -> ClipboardThe terminal component (TTerminalWindow) provides a VT100-compatible terminal emulator using Windows ConPTY. It supports running command-line applications including other Free Vision apps.
The terminal uses Ctrl+A as the escape prefix (like GNU screen):
| Key Sequence | Action |
|---|---|
| Ctrl+A, then any key | Exit capture mode, send key to outer app |
| Ctrl+A, Ctrl+A | Send literal Ctrl+A to child process |
| Ctrl+A, M | Toggle terminal mouse mode (passthrough/select) |
| Ctrl+C / Ctrl+Ins | Copy terminal selection to clipboard |
| Ctrl+V / Shift+Ins | Paste clipboard text to terminal process |
| Right click | Copy selection, or paste when no selection |
| Shift+PageUp/Down | Scroll through scrollback buffer |
| Mouse wheel | Scroll through scrollback buffer |
After exiting capture mode with Ctrl+A:
The terminal window title shows the current mouse mode:
Mouse:Pass forwards mouse to child apps that enable VT mouse reportingMouse:Select keeps mouse local for text selection/scrollingMouse:Select keeps keyboard capture, so typing continues while mouse stays localMouse:Select; use Ctrl+A, M to switch to passthrough?1049/?1047/?47) auto-switches to Mouse:Pass, then restores previous mode on exitThe TStringGrid component (Grid.pas) provides a spreadsheet-like data grid for console applications.
The grid supports RFC 4180-compliant CSV files:
// Load CSV file
Grid.LoadFromCSV('data.csv');
// Save to CSV
Grid.SaveToCSV('output.csv');
// With options
var Opts := TCSVOptions.Create;
Opts.Delimiter := cdSemicolon; // or cdComma, cdTab, cdPipe, cdAuto
Opts.CustomDelimiter := '~'; // Override with any character
Opts.UseFixedHeaderRow := True; // Headers as fixed row 0
Opts.Encoding := ceUTF8BOM; // UTF-8 with BOM (Excel compatible)
Grid.LoadFromCSV('data.csv', Opts);
Opts.Free;
| Property | Default | Description |
|---|---|---|
Delimiter | cdComma | Field delimiter (comma, semicolon, tab, pipe, auto-detect) |
CustomDelimiter | #0 | Override delimiter with any character |
Encoding | ceUTF8BOM | File encoding (UTF-8 BOM, UTF-8, ANSI) |
HasHeaders | True | First row contains column headers |
UseFixedHeaderRow | False | Put headers in fixed row 0 |
TrimWhitespace | False | Trim spaces from values |
AutoCreateColumns | True | Create columns from CSV structure |
The THexEditor component (HexEdit.pas) provides a binary file viewer and editor.
IHexDataSource)| Key | Action |
|---|---|
| Arrow keys | Navigate bytes |
| Tab | Toggle between hex and ASCII mode |
| Shift+Arrows | Extend selection |
| 0-9, A-F | Edit hex nibble (in hex mode) |
| Any printable | Edit ASCII character (in ASCII mode) |
| Home/End | Jump to start/end of row |
| Ctrl+Home/End | Jump to start/end of file |
| Page Up/Down | Scroll by page |
var
HexEdit: THexEditor;
Source: TMemoryHexSource;
begin
Source := TMemoryHexSource.Create;
Source.LoadFromFile('data.bin');
HexEdit := THexEditor.Create(Bounds, Source);
// ... add to window
// Save changes
Source.SaveToFile('data.bin');
end;
The framework uses a TDrawCell-based drawing system where each screen cell stores a full string instead of a single Char. This allows proper rendering of:
CheckMark, CrossMark, Diamond rendered as true Unicode glyphsFVBoxChars.pas)The rendering pipeline (TDrawBuffer -> WriteBuf -> UnicodeCharBuf -> VT escape sequences) preserves full Unicode fidelity from view drawing through to terminal output.
FVTest.dproj in the Delphi IDEprogram MyApp;
uses
App, Views, Menus, Drivers;
type
TMyApp = class(TApplication)
procedure InitMenuBar; override;
procedure InitStatusLine; override;
end;
procedure TMyApp.InitMenuBar;
var
R: TRect;
begin
GetExtent(R);
R.B.Y := R.A.Y + 1;
MenuBar := TMenuBar.Create(R, NewMenu(
NewSubMenu('~F~ile', hcNoContext, NewMenu(
NewItem('E~x~it', 'Alt-X', kbAltX, cmQuit, hcNoContext, nil)),
nil)));
end;
procedure TMyApp.InitStatusLine;
var
R: TRect;
begin
GetExtent(R);
R.A.Y := R.B.Y - 1;
StatusLine := TStatusLine.Create(R,
NewStatusDef(0, $FFFF,
NewStatusKey('~Alt-X~ Exit', kbAltX, cmQuit, nil),
nil));
end;
var
App: TMyApp;
begin
App := TMyApp.Create;
App.Run;
App.Free;
end.
src/
FVCommon.pas - Platform types (Sw_Word, PString, etc.)
FVInterfaces.pas - Interface definitions (IFVDrawable, ISerializable, etc.)
FVSerialization.pas - JSON serialization helpers
FVClipboard.pas - Windows clipboard integration helpers
Objects.pas - Stream classes, string utilities
Video.pas - Console output (Windows Console API)
Drivers.pas - Keyboard and mouse input handling
Views.pas - View hierarchy (TView, TGroup, TWindow, etc.)
Menus.pas - Menu system (TMenuBar, TMenuBox, TStatusLine)
App.pas - Application framework (TApplication)
Dialogs.pas - Dialog controls (TDialog, TButton, TInputLine, etc.)
Grid.pas - TStringGrid with CSV import/export
HexEdit.pas - THexEditor binary viewer/editor
SixelEncoder.pas - Adaptive SIXEL encoder (palette + dithering)
SixelView.pas - TSixelView + TSixelCanvasView for SIXEL rendering
ImageView.pas - BMP/SIXEL viewer window and scrollable image view
Validate.pas - Input validation
MsgBox.pas - Message box helpers
StdDlg.pas - Standard file dialogs
Editors.pas - Text editor components
ColorSel.pas - Color selection dialog
Outline.pas - Tree/outline view
Tabs.pas - Tab control
Statuses.pas - Progress gauges
Gadgets.pas - Clock and heap views
ProgressBar.pas - Progress bar indicator
Breadcrumb.pas - Clickable path navigation
ToolBar.pas - Horizontal button bar
ComboBox.pas - Dropdown select control
Splitter.pas - Draggable panel divider + split group container
Accordion.pas - Collapsible section stack
EditorGutter.pas - Multi-column editor gutter (line numbers, bookmarks, breakpoints, diff)
Notification.pas - Auto-dismissing toast popups
See ARCHITECTURE.md for detailed class hierarchies and diagrams.
CLASS syntax with proper inheritance and overrideTObject (no intermediate base class)IFVDrawable, IFVEventHandler, IFVDataAware, ISerializableTObjectList<T>, TStringList (no custom collection classes)TClass.Create / Object.Free instead of New(P, Init) / Dispose(P, Done)PView = TViewShortString used for FV string types (Sw_String, PString)This library is distributed under the GNU Lesser General Public License (LGPL) with the following linking exception:
As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.
See COPYING.TXT for the complete license text.
Several units in src/ are adapted from third-party MIT-licensed projects.
Upstream license texts live in third_party/.
| Unit | Upstream | License |
|---|---|---|
src/FVUnicodeWidth.pas | VSoft.AnsiConsole (Vincent Parrett); tables originate from spectreconsole/wcwidth, Unicode 15.1 data from the Unicode Consortium | MIT |
src/FVProfile.pas | VSoft.AnsiConsole — capability detection rules mirror Spectre.Console (Patrik Svensson, Phil Scott, Nils Andresen) | MIT |
src/SpinnerView.pas | VSoft.AnsiConsole frame data; spinner frames originate from cli-spinners by Sindre Sorhus | MIT |
src/TaskProgress.pas | Inspired by VSoft.AnsiConsole Live.Progress / Spectre.Console | MIT |
src/CheckListBox.pas | Inspired by VSoft.AnsiConsole Prompts.MultiSelect | MIT |
Bug reports and contributions are welcome. Please ensure any modifications maintain compatibility with the original Free Vision API where possible.
52 commits
Hacker News (1)
Pascal
100.0%
A modernized port of the Free Vision (FV) text-mode UI framework from Free Pascal to modern Delphi (12+).
Free Vision is a classic console-based GUI toolkit originally derived from Borland's Turbo Vision. This modern variant uses Delphi CLASS syntax instead of the legacy Turbo Pascal OBJECT syntax, providing better IDE integration, proper inheritance, and modern memory management.
IFVDrawable, ISerializable), RTL generics (TObjectList<T>, TStringList)TDrawCell-based drawing systemFVProfile probes VT support, color depth (no-color / 16 / 256 / 24-bit), interactivity, CI environment, hyperlink + Sixel support; NO_COLOR and CLICOLOR_FORCE honored. FVScreen.UpdateScreen downsamples 24-bit RGB to the host's color system.FVUnicodeWidth provides correct wide / combining / zero-width measurement for emoji, CJK, ZWJ joiners, and variation selectors.ISerializable for state persistenceSIXEL support is optimized for Windows Terminal sessions and integrates with the normal Free Vision view system.
TSixelEncoder (src/SixelEncoder.pas): converts TPixelGrid data ($00RRGGBB) to SIXEL DCS strings using adaptive palette quantization (up to 256 registers)TSixelView (src/SixelView.pas): renders pre-encoded SIXEL data from memory or .sixel/.six/.sxl filesTSixelCanvasView (src/SixelView.pas): direct pixel drawing API for generated/animated graphics (SetPixel, FillRect, DrawLine, Clear)TImageWindow/TImageView (src/ImageView.pas): loads both BMP and SIXEL files, supports scrolling and safe viewport cropping before SIXEL encodingWindows Terminal supports true-color text attributes, but SIXEL itself remains palette-based.
Practical limit is still 256 color registers per emitted SIXEL image, so quality depends on quantization and dithering choices.
TSixelEncoder supports error-diffusion dithering to reduce visible color banding:
FV_SIXEL_DITHER=1 (also accepts on, true)FV_SIXEL_DITHER=0 (also accepts off, false)If terminal pixel cell detection is wrong, you can override with:
FV_CELL_W=<pixels>FV_CELL_H=<pixels>Test -> New Components contains:
Image Viewer (BMP + SIXEL files)SIXEL Spectrometer (direct animated bar rendering on TSixelCanvasView)SIXEL Animated Sine (direct animated waveform drawing on TSixelCanvasView)System clipboard support is provided by src/FVClipboard.pas and is shared across editor-style controls.
| Function | Description |
|---|---|
ClipboardSetText(const Text: string): Boolean | Writes Unicode text to Windows clipboard |
ClipboardGetText: string | Reads text from Windows clipboard |
ClipboardHasText: Boolean | Returns whether text data is available |
Ctrl+Ins: copy selectionShift+Ins: paste clipboard textThe Test menu includes clipboard-focused examples:
Test -> Editor -> ClipboardTest -> New Components -> ClipboardThe terminal component (TTerminalWindow) provides a VT100-compatible terminal emulator using Windows ConPTY. It supports running command-line applications including other Free Vision apps.
The terminal uses Ctrl+A as the escape prefix (like GNU screen):
| Key Sequence | Action |
|---|---|
| Ctrl+A, then any key | Exit capture mode, send key to outer app |
| Ctrl+A, Ctrl+A | Send literal Ctrl+A to child process |
| Ctrl+A, M | Toggle terminal mouse mode (passthrough/select) |
| Ctrl+C / Ctrl+Ins | Copy terminal selection to clipboard |
| Ctrl+V / Shift+Ins | Paste clipboard text to terminal process |
| Right click | Copy selection, or paste when no selection |
| Shift+PageUp/Down | Scroll through scrollback buffer |
| Mouse wheel | Scroll through scrollback buffer |
After exiting capture mode with Ctrl+A:
The terminal window title shows the current mouse mode:
Mouse:Pass forwards mouse to child apps that enable VT mouse reportingMouse:Select keeps mouse local for text selection/scrollingMouse:Select keeps keyboard capture, so typing continues while mouse stays localMouse:Select; use Ctrl+A, M to switch to passthrough?1049/?1047/?47) auto-switches to Mouse:Pass, then restores previous mode on exitThe TStringGrid component (Grid.pas) provides a spreadsheet-like data grid for console applications.
The grid supports RFC 4180-compliant CSV files:
// Load CSV file
Grid.LoadFromCSV('data.csv');
// Save to CSV
Grid.SaveToCSV('output.csv');
// With options
var Opts := TCSVOptions.Create;
Opts.Delimiter := cdSemicolon; // or cdComma, cdTab, cdPipe, cdAuto
Opts.CustomDelimiter := '~'; // Override with any character
Opts.UseFixedHeaderRow := True; // Headers as fixed row 0
Opts.Encoding := ceUTF8BOM; // UTF-8 with BOM (Excel compatible)
Grid.LoadFromCSV('data.csv', Opts);
Opts.Free;
| Property | Default | Description |
|---|---|---|
Delimiter | cdComma | Field delimiter (comma, semicolon, tab, pipe, auto-detect) |
CustomDelimiter | #0 | Override delimiter with any character |
Encoding | ceUTF8BOM | File encoding (UTF-8 BOM, UTF-8, ANSI) |
HasHeaders | True | First row contains column headers |
UseFixedHeaderRow | False | Put headers in fixed row 0 |
TrimWhitespace | False | Trim spaces from values |
AutoCreateColumns | True | Create columns from CSV structure |
The THexEditor component (HexEdit.pas) provides a binary file viewer and editor.
IHexDataSource)| Key | Action |
|---|---|
| Arrow keys | Navigate bytes |
| Tab | Toggle between hex and ASCII mode |
| Shift+Arrows | Extend selection |
| 0-9, A-F | Edit hex nibble (in hex mode) |
| Any printable | Edit ASCII character (in ASCII mode) |
| Home/End | Jump to start/end of row |
| Ctrl+Home/End | Jump to start/end of file |
| Page Up/Down | Scroll by page |
var
HexEdit: THexEditor;
Source: TMemoryHexSource;
begin
Source := TMemoryHexSource.Create;
Source.LoadFromFile('data.bin');
HexEdit := THexEditor.Create(Bounds, Source);
// ... add to window
// Save changes
Source.SaveToFile('data.bin');
end;
The framework uses a TDrawCell-based drawing system where each screen cell stores a full string instead of a single Char. This allows proper rendering of:
CheckMark, CrossMark, Diamond rendered as true Unicode glyphsFVBoxChars.pas)The rendering pipeline (TDrawBuffer -> WriteBuf -> UnicodeCharBuf -> VT escape sequences) preserves full Unicode fidelity from view drawing through to terminal output.
FVTest.dproj in the Delphi IDEprogram MyApp;
uses
App, Views, Menus, Drivers;
type
TMyApp = class(TApplication)
procedure InitMenuBar; override;
procedure InitStatusLine; override;
end;
procedure TMyApp.InitMenuBar;
var
R: TRect;
begin
GetExtent(R);
R.B.Y := R.A.Y + 1;
MenuBar := TMenuBar.Create(R, NewMenu(
NewSubMenu('~F~ile', hcNoContext, NewMenu(
NewItem('E~x~it', 'Alt-X', kbAltX, cmQuit, hcNoContext, nil)),
nil)));
end;
procedure TMyApp.InitStatusLine;
var
R: TRect;
begin
GetExtent(R);
R.A.Y := R.B.Y - 1;
StatusLine := TStatusLine.Create(R,
NewStatusDef(0, $FFFF,
NewStatusKey('~Alt-X~ Exit', kbAltX, cmQuit, nil),
nil));
end;
var
App: TMyApp;
begin
App := TMyApp.Create;
App.Run;
App.Free;
end.
src/
FVCommon.pas - Platform types (Sw_Word, PString, etc.)
FVInterfaces.pas - Interface definitions (IFVDrawable, ISerializable, etc.)
FVSerialization.pas - JSON serialization helpers
FVClipboard.pas - Windows clipboard integration helpers
Objects.pas - Stream classes, string utilities
Video.pas - Console output (Windows Console API)
Drivers.pas - Keyboard and mouse input handling
Views.pas - View hierarchy (TView, TGroup, TWindow, etc.)
Menus.pas - Menu system (TMenuBar, TMenuBox, TStatusLine)
App.pas - Application framework (TApplication)
Dialogs.pas - Dialog controls (TDialog, TButton, TInputLine, etc.)
Grid.pas - TStringGrid with CSV import/export
HexEdit.pas - THexEditor binary viewer/editor
SixelEncoder.pas - Adaptive SIXEL encoder (palette + dithering)
SixelView.pas - TSixelView + TSixelCanvasView for SIXEL rendering
ImageView.pas - BMP/SIXEL viewer window and scrollable image view
Validate.pas - Input validation
MsgBox.pas - Message box helpers
StdDlg.pas - Standard file dialogs
Editors.pas - Text editor components
ColorSel.pas - Color selection dialog
Outline.pas - Tree/outline view
Tabs.pas - Tab control
Statuses.pas - Progress gauges
Gadgets.pas - Clock and heap views
ProgressBar.pas - Progress bar indicator
Breadcrumb.pas - Clickable path navigation
ToolBar.pas - Horizontal button bar
ComboBox.pas - Dropdown select control
Splitter.pas - Draggable panel divider + split group container
Accordion.pas - Collapsible section stack
EditorGutter.pas - Multi-column editor gutter (line numbers, bookmarks, breakpoints, diff)
Notification.pas - Auto-dismissing toast popups
See ARCHITECTURE.md for detailed class hierarchies and diagrams.
CLASS syntax with proper inheritance and overrideTObject (no intermediate base class)IFVDrawable, IFVEventHandler, IFVDataAware, ISerializableTObjectList<T>, TStringList (no custom collection classes)TClass.Create / Object.Free instead of New(P, Init) / Dispose(P, Done)PView = TViewShortString used for FV string types (Sw_String, PString)This library is distributed under the GNU Lesser General Public License (LGPL) with the following linking exception:
As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.
See COPYING.TXT for the complete license text.
Several units in src/ are adapted from third-party MIT-licensed projects.
Upstream license texts live in third_party/.
| Unit | Upstream | License |
|---|---|---|
src/FVUnicodeWidth.pas | VSoft.AnsiConsole (Vincent Parrett); tables originate from spectreconsole/wcwidth, Unicode 15.1 data from the Unicode Consortium | MIT |
src/FVProfile.pas | VSoft.AnsiConsole — capability detection rules mirror Spectre.Console (Patrik Svensson, Phil Scott, Nils Andresen) | MIT |
src/SpinnerView.pas | VSoft.AnsiConsole frame data; spinner frames originate from cli-spinners by Sindre Sorhus | MIT |
src/TaskProgress.pas | Inspired by VSoft.AnsiConsole Live.Progress / Spectre.Console | MIT |
src/CheckListBox.pas | Inspired by VSoft.AnsiConsole Prompts.MultiSelect | MIT |
Bug reports and contributions are welcome. Please ensure any modifications maintain compatibility with the original Free Vision API where possible.
Hacker News (1)
52 commits
Pascal
100.0%