FMX-Terminal is a high-performance terminal emulator component (VT100/ANSI) for Delphi FireMonkey, leveraging the Skia library for hardware-accelerated rendering.
Designed for developers who need a fast, smooth, and cross-platform terminal implementation within FMX applications.
- High Performance:
- Powered by Skia for GPU-accelerated rendering.
- Batch Rendering: Groups characters to minimize draw calls.
- Dirty Lines: Only modified lines are repainted to save resources.
- Hardware Scroll: Scrolling is implemented via bitmap shifting (Backbuffer), ensuring smoothness even with high data throughput.
- Compatibility:
- Supports major VT100/Xterm/ANSI control sequences.
- Correct rendering of Line Drawing characters — borders in mc, htop, and ncdu look perfect.
- Support for 256 colors and TrueColor.
- Functionality:
- Mouse text selection (similar to Putty/VSCode).
- Clipboard support (Ctrl+Shift+C / Ctrl+Shift+V).
- Mouse reporting support (clicks, scroll) in console applications (SGR mouse mode).
- Theme support (loading from .theme files).
- Smart Scrollback history.
- Delphi 12 Athens (Recommended) — Skia is built-in, no additional installation required.
- Or Delphi 11 Alexandria — requires Skia4Delphi installed via GetIt.
- Download this repository.
- Add the source code folder to your IDE's Library Path or place the files next to your project.
- Enable Skia in your project:
- For Delphi 12: In the .dpr file or initialization code, ensure GlobalUseSkia := True; is set.
- For older versions: Right-click the project -> Enable Skia.
The TnbTerminal component (descendant of TSkPaintBox) can be created dynamically or used at Design-time (if registered).
uses
Terminal.Control, Terminal.Theme;
procedure TFormMain.FormCreate(Sender: TObject);
begin
// Create terminal
Terminal := TnbTerminal.Create(Self);
Terminal.Parent := LayoutClient;
Terminal.Align := TAlignLayout.Client;
// Configure font (monospaced font is required)
Terminal.FontFamily := 'Consolas';
Terminal.FontSize := 13;
// Attach data handler (captures user input)
Terminal.OnData := DoTerminalData;
end;
// Send data to server (e.g., via socket)
procedure TFormMain.DoTerminalData(const S: string);
begin
MySocket.Send(S);
end;
// Receive data from server
procedure TFormMain.OnSocketRead(const Data: string);
begin
Terminal.WriteText(Data);
end;
You can load color schemes from files:
Terminal.Theme.LoadThemeFromFile('Solarized-Dark.theme');
The Demo folder contains a sample application using SecureBridge (Devart) to connect to SSH servers.
Note: The demo requires SecureBridge components to compile. However, the terminal component itself is network-agnostic and can be easily used with Indy, TClientSocket, or any other library.
Contributions are welcome! If you find a bug in ANSI parsing or want to add a new feature:
- Fork the repository.
- Create a branch (git checkout -b feature/NewFeature).
- Commit your changes.
- Create a Pull Request.
This project is licensed under the MIT License. See the LICENSE file for details.