public class TerminalView extends Canvas
Reusable interactive terminal widget backed by PseudoTerminal.
TerminalView is intentionally part of the GUI library, not the editor tool, so applications can embed a real shell-like terminal with keyboard input, ANSI line editing, scrolling and process lifecycle notification. In a docked tab surface, that surface owns the frame and focus contour; the terminal paints a flat background without an additional inner border. ANSI SGR foreground/background colors (16, 256 and RGB), intensity, underline and inverse video are retained with the text. Default colors follow the current GUI theme; explicit terminal colors remain content. Typing or editing returns to the prompt; incoming output preserves the position of a reader who has scrolled back. Escape and F1–F12 are forwarded using the terminal's xterm key sequences. Column geometry uses the actual advance of the same font used for painting.
terminal = TerminalView()
terminal.terminated += lambda(e as ActionEvent): print("shell closed")
terminal.runCommand("pwd")| Modifier and Type | Member | Description |
|---|---|---|
| public readonly property | isRunningisRunning as Boolean |
True while the backing pseudo-terminal process is still running. |
| public readonly property | workingDirectoryworkingDirectory as String |
Current working directory of the underlying shell. |
| Modifier and Type | Member | Description |
|---|---|---|
| public signal property | cwdcwd as String |
Current working directory tracked by the terminal. |
| Modifier and Type | Member | Description |
|---|---|---|
| public event | terminatedterminated as ActionEvent |
Emitted once the process has exited, its remaining output has been displayed and the pseudo-terminal has been released. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | TerminalViewTerminalView(command as String = "", cwd as String = "", terminalFont as String = "", fontSize as Int = 14) |
Creates and starts a terminal. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | appendappend(line as String) as Void |
Appends text to the terminal display without writing to the shell. |
| public | applyFont | Updates the rendered font and recomputes the terminal geometry. |
| public | closeclose() as Void |
Stops polling and closes the underlying pseudo-terminal without clearing the displayed text. |
| public override | handleTabKey | Sends Tab or Shift+Tab to the terminal instead of moving focus. |
| public override | paintpaint(painter as Painter) as Void |
No summary. |
| public | runCommandrunCommand(command as String) as Void |
Writes a command followed by the terminal Enter sequence. |