TerminalEmulator

sealed interface TerminalEmulator(source)

Terminal emulator interface. This has no dependency on any UI framework so it may be run in a Service on Android. It handles the management of the terminal emulation state.

Properties

Link copied to clipboard
abstract val autoDetectUrls: Boolean

Whether plain-text URL auto-detection is enabled.

Link copied to clipboard
abstract val boldAsBright: Boolean

Whether bold text using low-intensity ANSI colors (0–7) promotes to the corresponding bright palette color (8–15), matching xterm's boldColors behavior.

Link copied to clipboard
Link copied to clipboard

Policy controlling whether incoming inline image commands are accepted.

Functions

Link copied to clipboard
abstract fun applyColorScheme(ansiColors: IntArray, defaultForeground: Int, defaultBackground: Int)

Apply a complete color scheme to the terminal.

Link copied to clipboard
abstract fun clearScreen()

Clears the terminal emulator screen.

Link copied to clipboard
open fun dispatchCharacter(modifiers: Int, ch: Char)
abstract fun dispatchCharacter(modifiers: Int, codepoint: Int)

Dispatch a character to the terminal.

Link copied to clipboard
abstract fun dispatchKey(modifiers: Int, key: Int)

Dispatch a key event to the terminal.

Link copied to clipboard
abstract fun getLastCommandOutput(): String?

Get the text output of the last completed command.

Link copied to clipboard
abstract fun getUrls(scope: UrlScanScope = UrlScanScope.CurrentView): List<TerminalUrl>

Extract URLs from terminal output.

Link copied to clipboard
abstract fun pasteText(text: String)

Queue pasted text in the same FIFO as keyboard/IME input, honoring bracketed paste.

Link copied to clipboard
abstract fun resize(newRows: Int, newCols: Int)

Resize the terminal.

Link copied to clipboard
abstract fun setAnsiPalette(ansiColors: IntArray): Int

Set ANSI palette colors (indices 0-15).

Link copied to clipboard
abstract fun setCellPixelSize(width: Int, height: Int)

Physical cell dimensions used by image placement; defaults to 8 by 16 pixels.

Link copied to clipboard
abstract fun setDefaultColors(foreground: Int, background: Int): Int

Set default terminal colors.

Link copied to clipboard
abstract fun setInlineImages(inlineImages: InlineImages)

Changing policy cancels in-progress and pending image uploads.

Link copied to clipboard
abstract fun writeInput(buffer: ByteBuffer, length: Int)

Write data to the terminal using ByteBuffer (more efficient for large data).

abstract fun writeInput(data: ByteArray, offset: Int = 0, length: Int = data.size - offset)

Write data to the terminal (from PTY/transport).