### Bash Shell Integration for OSC 133 Source: https://github.com/connectbot/termlib/blob/main/docs/ACCESSIBILITY.md Add this to your ~/.bashrc to enable ConnectBot's semantic navigation features, specifically prompt jumping. Ensure bash-preexec is installed for full functionality. ```bash # ConnectBot integration (OSC 133) PS1='[\e]133;A\e]'$PS1'[\e]133;B\e]' __bp_preexec_interactive() { printf '\e]133;C\e\' } preexec_functions+=(__bp_preexec_interactive) __bp_precmd_interactive() { printf '\e]133;D;%s\e\\' "$?" } precmd_functions+=(__bp_precmd_interactive) ``` -------------------------------- ### ComposeController Source: https://github.com/connectbot/termlib/blob/main/lib/api.txt Manages the compose mode for text input. Allows starting, stopping, and toggling compose mode, as well as retrieving composed text and checking the active state. ```APIDOC ## ComposeController ### Description Manages the compose mode for text input. Allows starting, stopping, and toggling compose mode, as well as retrieving composed text and checking the active state. ### Methods - `getComposedText()`: Returns the currently composed text. - `getPendingDeadChar()`: Returns the pending dead character (inaccessible from Kotlin). - `isComposeModeActive()`: Checks if compose mode is currently active. - `startComposeMode()`: Activates compose mode. - `stopComposeMode()`: Deactivates compose mode. - `toggleComposeMode()`: Toggles the state of compose mode. ### Properties - `isComposeModeActive` (boolean): Indicates if compose mode is active. - `pendingDeadChar` (int): The pending dead character. ``` -------------------------------- ### Initialize and Use Terminal Emulator Source: https://github.com/connectbot/termlib/blob/main/lib/README.md Shows how to create a terminal emulator instance, handle keyboard input, write data to the emulator, and render it in a Compose UI. Ensure callbacks do not re-enter Terminal methods to avoid deadlocks. ```kotlin val emulator = TerminalEmulatorFactory.create( onKeyBoardInput = { // … send data to PTY/SSH/etc } ) // Feed data from PTY/SSH emulator.writeInput(data, offset, length) // Render Terminal( terminalEmulator = emulator ) ``` -------------------------------- ### TerminalEmulatorFactory.Companion.create Source: https://github.com/connectbot/termlib/blob/main/lib/api.txt Factory method to create a new TerminalEmulator instance with various configuration options. ```APIDOC ## TerminalEmulatorFactory.Companion.create ### Description Creates a new `TerminalEmulator` instance with customizable settings. ### Method Signature `create(optional android.os.Looper looper, optional int initialRows, optional int initialCols, optional androidx.compose.ui.graphics.Color defaultForeground, optional androidx.compose.ui.graphics.Color defaultBackground, optional kotlin.jvm.functions.Function1 onKeyboardInput, optional kotlin.jvm.functions.Function0? onBell, optional kotlin.jvm.functions.Function1? onResize, optional kotlin.jvm.functions.Function1? onClipboardCopy, optional kotlin.jvm.functions.Function2? onProgressChange, optional boolean autoDetectUrls, optional boolean boldAsBright)` ### Parameters - `looper` (android.os.Looper): Optional looper for the terminal. - `initialRows` (int): Optional initial number of rows. - `initialCols` (int): Optional initial number of columns. - `defaultForeground` (androidx.compose.ui.graphics.Color): Optional default foreground color. - `defaultBackground` (androidx.compose.ui.graphics.Color): Optional default background color. - `onKeyboardInput` (kotlin.jvm.functions.Function1): Optional callback for keyboard input. - `onBell` (kotlin.jvm.functions.Function0): Optional callback for bell events. - `onResize` (kotlin.jvm.functions.Function1): Optional callback for resize events. - `onClipboardCopy` (kotlin.jvm.functions.Function1): Optional callback for clipboard copy events. - `onProgressChange` (kotlin.jvm.functions.Function2): Optional callback for progress changes. - `autoDetectUrls` (boolean): Optional flag to enable URL auto-detection. - `boldAsBright` (boolean): Optional flag to render bold text as bright. ``` -------------------------------- ### ConnectBot Terminal Architecture Overview Source: https://github.com/connectbot/termlib/blob/main/lib/README.md Illustrates the data flow and interaction between the PTY/SSH, TerminalEmulator, libvterm, and the Terminal UI. Highlights the separation of concerns and potential reentrancy issues. ```text PTY/SSH → TerminalEmulator.writeInput() → libvterm → Callbacks → TerminalEmulator → Terminal Keyboard → TerminalEmulator.dispatchKey() → libvterm → onKeyboardInput() → PTY/SSH ``` -------------------------------- ### Zsh Shell Integration for OSC 133 Source: https://github.com/connectbot/termlib/blob/main/docs/ACCESSIBILITY.md Add this to your ~/.zshrc to enable ConnectBot's semantic navigation features, specifically prompt jumping. This configuration ensures proper handling of escape sequences for prompt detection. ```zsh # ConnectBot integration (OSC 133) setopt PROMPT_SP PS1=$'%{\e]133;A\e\%}'$PS1$'%{\e]133;B\e\%}' preexec() { print -Pn '\e]133;C\e\' } precmd() { print -Pn '\e]133;D;%?\e\' } ``` -------------------------------- ### TerminalEmulator Interface Source: https://github.com/connectbot/termlib/blob/main/lib/api.txt The TerminalEmulator interface defines the core methods for interacting with a terminal emulator. ```APIDOC ## TerminalEmulator Interface ### Description This interface provides methods to control and query a terminal emulator. ### Methods - `applyColorScheme(int[] ansiColors, int defaultForeground, int defaultBackground)`: Applies a color scheme to the terminal. - `clearScreen()`: Clears the terminal screen. - `dispatchCharacter(int modifiers, char ch)`: Dispatches a character event (deprecated). - `dispatchCharacter(int modifiers, int codepoint)`: Dispatches a character event using a codepoint. - `dispatchKey(int modifiers, int key)`: Dispatches a key event. - `getAutoDetectUrls()`: Checks if URL auto-detection is enabled. - `getBoldAsBright()`: Checks if bold text is rendered as bright. - `getDimensions()`: Retrieves the terminal dimensions. - `getLastCommandOutput()`: Gets the output of the last executed command. - `getUrls(optional org.connectbot.terminal.UrlScanScope scope)`: Retrieves a list of URLs found in the terminal. - `resize(int newRows, int newCols)`: Resizes the terminal to the specified dimensions. - `setAnsiPalette(int[] ansiColors)`: Sets the ANSI color palette. - `setDefaultColors(int foreground, int background)`: Sets the default foreground and background colors. - `writeInput(byte[] data, optional int offset, optional int length)`: Writes raw byte data to the terminal input. - `writeInput(java.nio.ByteBuffer buffer, int length)`: Writes data from a ByteBuffer to the terminal input. ``` -------------------------------- ### SelectionController Source: https://github.com/connectbot/termlib/blob/main/lib/api.txt Controls the text selection process within the terminal. Supports copying selected text, managing selection modes, and manipulating the selection area. ```APIDOC ## SelectionController ### Description Controls the text selection process within the terminal. Supports copying selected text, managing selection modes, and manipulating the selection area. ### Methods - `clearSelection()`: Clears the current text selection. - `copySelection()`: Copies the selected text to the clipboard. - `finishSelection()`: Finalizes the current selection. - `isSelectionActive()`: Checks if a selection is currently active (inaccessible from Kotlin). - `moveSelectionDown()`: Moves the selection boundary down. - `moveSelectionLeft()`: Moves the selection boundary left. - `moveSelectionRight()`: Moves the selection boundary right. - `moveSelectionUp()`: Moves the selection boundary up. - `selectAll()`: Selects all text in the terminal. - `setSelectionMode(mode)`: Sets the selection mode to the specified mode. - `startSelection(mode)`: Starts a new text selection with an optional initial mode. - `toggleSelection()`: Toggles the selection state. - `toggleSelectionMode()`: Toggles the current selection mode. ### Properties - `isSelectionActive` (boolean): Indicates if a selection is currently active. ``` -------------------------------- ### TerminalKt.Terminal Composable Source: https://github.com/connectbot/termlib/blob/main/lib/api.txt A Composable function to render a terminal UI component. ```APIDOC ## TerminalKt.Terminal ### Description A Jetpack Compose Composable function that renders a terminal emulator UI. ### Method Signature `Terminal(org.connectbot.terminal.TerminalEmulator terminalEmulator, optional androidx.compose.ui.Modifier modifier, optional android.graphics.Typeface typeface, optional androidx.compose.ui.unit.TextUnit initialFontSize, optional androidx.compose.ui.unit.TextUnit minFontSize, optional androidx.compose.ui.unit.TextUnit maxFontSize, optional androidx.compose.ui.graphics.Color backgroundColor, optional androidx.compose.ui.graphics.Color foregroundColor, optional androidx.compose.ui.graphics.Color selectionBackgroundColor, optional androidx.compose.ui.graphics.Color selectionForegroundColor, optional boolean keyboardEnabled, optional boolean showSoftKeyboard, optional androidx.compose.ui.focus.FocusRequester focusRequester, optional kotlin.jvm.functions.Function0 onTerminalTap, optional kotlin.jvm.functions.Function1 onImeVisibilityChanged, optional kotlin.Pair? forcedSize, optional org.connectbot.terminal.ModifierManager? modifierManager, optional kotlin.jvm.functions.Function1? onSelectionControllerAvailable, optional kotlin.jvm.functions.Function1 onHyperlinkClick, optional kotlin.jvm.functions.Function1? onComposeControllerAvailable, optional kotlin.jvm.functions.Function0? onPasteRequest, optional org.connectbot.terminal.RightAltMode rightAltMode, optional org.connectbot.terminal.DelKeyMode delKeyMode, optional kotlin.jvm.functions.Function1? onInterceptKey)` ### Parameters - `terminalEmulator` (org.connectbot.terminal.TerminalEmulator): The terminal emulator instance. - `modifier` (androidx.compose.ui.Modifier): Optional modifier for the composable. - `typeface` (android.graphics.Typeface): Optional typeface for the terminal text. - `initialFontSize` (androidx.compose.ui.unit.TextUnit): Optional initial font size. - `minFontSize` (androidx.compose.ui.unit.TextUnit): Optional minimum font size. - `maxFontSize` (androidx.compose.ui.unit.TextUnit): Optional maximum font size. - `backgroundColor` (androidx.compose.ui.graphics.Color): Optional background color. - `foregroundColor` (androidx.compose.ui.graphics.Color): Optional foreground color. - `selectionBackgroundColor` (androidx.compose.ui.graphics.Color): Optional selection background color. - `selectionForegroundColor` (androidx.compose.ui.graphics.Color): Optional selection foreground color. - `keyboardEnabled` (boolean): Optional flag to enable the keyboard. - `showSoftKeyboard` (boolean): Optional flag to show the soft keyboard. - `focusRequester` (androidx.compose.ui.focus.FocusRequester): Optional focus requester. - `onTerminalTap` (kotlin.jvm.functions.Function0): Optional callback for terminal tap events. - `onImeVisibilityChanged` (kotlin.jvm.functions.Function1): Optional callback for IME visibility changes. - `forcedSize` (kotlin.Pair): Optional forced size for the terminal. - `modifierManager` (org.connectbot.terminal.ModifierManager): Optional modifier manager. - `onSelectionControllerAvailable` (kotlin.jvm.functions.Function1): Optional callback when the selection controller is available. - `onHyperlinkClick` (kotlin.jvm.functions.Function1): Optional callback for hyperlink clicks. - `onComposeControllerAvailable` (kotlin.jvm.functions.Function1): Optional callback when the compose controller is available. - `onPasteRequest` (kotlin.jvm.functions.Function0): Optional callback for paste requests. - `rightAltMode` (org.connectbot.terminal.RightAltMode): Optional mode for the right Alt key. - `delKeyMode` (org.connectbot.terminal.DelKeyMode): Optional mode for the Del key. - `onInterceptKey` (kotlin.jvm.functions.Function1): Optional callback to intercept key events. ``` -------------------------------- ### TerminalUrl Class Source: https://github.com/connectbot/termlib/blob/main/lib/api.txt Represents a URL found within the terminal. ```APIDOC ## TerminalUrl Class ### Description Represents a URL detected in the terminal output, along with its source. ### Constructor `TerminalUrl(String url, org.connectbot.terminal.TerminalUrlSource source)` ### Properties - `url` (String): The URL string. - `source` (org.connectbot.terminal.TerminalUrlSource): The source from which the URL was detected. ``` -------------------------------- ### TerminalDimensions Source: https://github.com/connectbot/termlib/blob/main/lib/api.txt Represents the dimensions of the terminal, including rows and columns. ```APIDOC ## TerminalDimensions ### Description Represents the dimensions of the terminal, including rows and columns. ### Constructor - `TerminalDimensions(rows: int, columns: int)`: Creates a new TerminalDimensions object. ### Methods - `component1()`: Returns the number of rows. - `component2()`: Returns the number of columns. - `copy(rows: int, columns: int)`: Creates a copy of the TerminalDimensions object with optional updated rows and columns. - `getColumns()`: Returns the number of columns (inaccessible from Kotlin). - `getRows()`: Returns the number of rows (inaccessible from Kotlin). ### Properties - `columns` (int): The number of columns in the terminal. - `rows` (int): The number of rows in the terminal. ``` -------------------------------- ### ModifierManager Source: https://github.com/connectbot/termlib/blob/main/lib/api.txt Manages modifier key states (Alt, Ctrl, Shift). Allows checking if specific modifier keys are currently active and clearing transient states. ```APIDOC ## ModifierManager ### Description Manages modifier key states (Alt, Ctrl, Shift). Allows checking if specific modifier keys are currently active and clearing transient states. ### Methods - `clearTransients()`: Clears any transient modifier states. - `isAltActive()`: Checks if the Alt key is currently active. - `isCtrlActive()`: Checks if the Ctrl key is currently active. - `isShiftActive()`: Checks if the Shift key is currently active. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.