JediTerm Documentation
repository·master·Indexed 21 days ago
https://github.com/jetbrains/jeditermA pure Java terminal widget for embedding in IDEs, featuring VT100/Xterm emulation and support for local PTY and SSH sessions. It provides a Java Swing-based terminal panel UI and is used by JetBrains IDEs such as IntelliJ IDEA, PyCharm, and CLion. Key features include Xterm 256 color support, terminal resizing, and cross-platform local terminal support via Pty4J.
What's inside JediTerm
- JediTerm is a pure Java terminal widget designed to be embedded into IDEs. It provides a VT100 compatible terminal emulator and a Java Swing-based terminal panel UI. It supports terminal sessions for both SSH connections and local PTY on macOS, Linux, and Windows. The library is used by various JetBrains IDEs including PyCharm, IntelliJ IDEA, PhpStorm, WebStorm, AppCode, CLion, and Rider.
Project Structure and Sub-projects
masterJediTerm is built using Gradle and is organized into four main sub-projects:
- terminal: The core library containing the VT100 compatible terminal emulator and the Java Swing terminal panel UI implementation.
- pty: The
jediterm-pty.jarlibrary which uses Pty4J to enable local PTY terminal sessions. - JediTerm: The standalone terminal application distributed as a
.dmgfor macOS. - (Implicitly) Build/Distribution: The project uses Gradle for the build lifecycle.
Run the standalone JediTerm terminal
masterTo run the standalone version of the JediTerm terminal from the source code, execute the provided shell or batch scripts. Alternatively, you can download the pre-built binary distribution from the GitHub Releases page. For macOS users, a standalone
.dmgdistribution is available../jediterm.shjediterm.batKey Features of JediTerm
masterJediTerm provides the following terminal capabilities:
- Local Terminal Support: Works on Unix, Mac, and Windows using the Pty4J library.
- Xterm Emulation: Supports Xterm emulation (passes most
vttesttests). - Color Support: Xterm 256 colours.
- UI Features: Scrolling, Copy/Paste, Mouse support, and Terminal tabs.
- Resizing: Supports terminal resizing from both the client and server sides.
Use TerminalDataStream for terminal data communication
masterThe
TerminalDataStreaminterface provides a mechanism for bidirectional character-based communication with a terminal. It supports reading individual characters, pushing characters back into the stream, and bulk reading of non-control ASCII characters for performance. Implement this interface to bridge a terminal session with a data source or buffer.// Example of interacting with a TerminalDataStream implementation void processStream(TerminalDataStream stream) throws IOException { char c = stream.getChar(); stream.pushChar(c); // Bulk read non-control characters for efficiency String chunk = stream.readNonControlCharacters(1024); // Push a buffer of characters back into the stream char[] buffer = {'a', 'b', 'c'}; stream.pushBackBuffer(buffer, 3); }Handle EOF in TerminalDataStream
masterThe
TerminalDataStream.EOFexception is a specializedIOExceptionused to signal that the terminal data stream has reached the end-of-file or that the connection has been lost. When implementing or consuming aTerminalDataStream, catch this exception to gracefully handle stream termination.try { char c = stream.getChar(); } catch (TerminalDataStream.EOF e) { // Handle end of stream or lost connection }Use CellPosition to represent terminal grid coordinates
masterThe
CellPositionclass is used to represent a specific coordinate within a terminal grid. It uses a one-based indexing system for both columns (x) and rows (y).When instantiating
CellPosition, bothxandymust be greater than or equal to 1. Providing a value less than 1 will result in anIllegalArgumentException.// Example of creating a position at column 1, row 1 val position = CellPosition(x = 1, y = 1) // Accessing coordinates println(position.x) // 1 println(position.y) // 1 // String representation println(position.toString()) // "column=1, row=1"