diff --git a/terminal-emulator/src/main/java/com/termux/terminal/TerminalBuffer.java b/terminal-emulator/src/main/java/com/termux/terminal/TerminalBuffer.java index 8a78bb83..df9b58b3 100644 --- a/terminal-emulator/src/main/java/com/termux/terminal/TerminalBuffer.java +++ b/terminal-emulator/src/main/java/com/termux/terminal/TerminalBuffer.java @@ -3,7 +3,7 @@ package com.termux.terminal; /** * A circular buffer of {@link TerminalRow}:s which keeps notes about what is visible on a logical screen and the scroll * history. - *
+ ** See {@link #externalToInternalRow(int)} for how to map from logical screen rows to array indices. */ public final class TerminalBuffer { @@ -92,22 +92,20 @@ public final class TerminalBuffer { /** * Convert a row value from the public external coordinate system to our internal private coordinate system. - *
- *- * [ ... ] [ ... ] - * [ -mActiveTranscriptRows ] [ mScreenFirstRow - mActiveTranscriptRows ] - * [ ... ] [ ... ] - * [ 0 (visible screen starts here) ] <-----> [ mScreenFirstRow ] - * [ ... ] [ ... ] - * [ mScreenRows-1 ] [ mScreenFirstRow + mScreenRows-1 ] + * - External coordinate system: -mActiveTranscriptRows to mScreenRows-1, with the screen being 0..mScreenRows-1. + * - Internal coordinate system: the mScreenRows lines starting at mScreenFirstRow comprise the screen, while the + * mActiveTranscriptRows lines ending at mScreenFirstRow-1 form the transcript (as a circular buffer). + * + * External ↔ Internal: + * + * [ ... ] [ ... ] + * [ -mActiveTranscriptRows ] [ mScreenFirstRow - mActiveTranscriptRows ] + * [ ... ] [ ... ] + * [ 0 (visible screen starts here) ] ↔ [ mScreenFirstRow ] + * [ ... ] [ ... ] + * [ mScreenRows-1 ] [ mScreenFirstRow + mScreenRows-1 ] ** * @param externalRow a row in the external coordinate system. diff --git a/terminal-emulator/src/main/java/com/termux/terminal/TerminalRow.java b/terminal-emulator/src/main/java/com/termux/terminal/TerminalRow.java index d069545a..8d5a271a 100644 --- a/terminal-emulator/src/main/java/com/termux/terminal/TerminalRow.java +++ b/terminal-emulator/src/main/java/com/termux/terminal/TerminalRow.java @@ -4,7 +4,7 @@ import java.util.Arrays; /** * A row in a terminal, composed of a fixed number of cells. - * + *
* The text in the row is stored in a char[] array, {@link #mText}, for quick access during rendering. */ public final class TerminalRow { diff --git a/terminal-emulator/src/main/java/com/termux/terminal/TerminalSession.java b/terminal-emulator/src/main/java/com/termux/terminal/TerminalSession.java index 4195ac19..5b82b0f9 100644 --- a/terminal-emulator/src/main/java/com/termux/terminal/TerminalSession.java +++ b/terminal-emulator/src/main/java/com/termux/terminal/TerminalSession.java @@ -19,13 +19,13 @@ import java.util.UUID; /** * A terminal session, consisting of a process coupled to a terminal interface. - *
+ ** The subprocess will be executed by the constructor, and when the size is made known by a call to * {@link #updateSize(int, int)} terminal emulation will begin and threads will be spawned to handle the subprocess I/O. * All terminal emulation and callback methods will be performed on the main thread. - *
+ ** The child process may be exited forcefully by using the {@link #finishIfRunning()} method. - *
+ ** NOTE: The terminal session may outlive the EmulatorView, so be careful with callbacks! */ public final class TerminalSession extends TerminalOutput { diff --git a/terminal-emulator/src/main/java/com/termux/terminal/TextStyle.java b/terminal-emulator/src/main/java/com/termux/terminal/TextStyle.java index b6ab44dd..173d6ae9 100644 --- a/terminal-emulator/src/main/java/com/termux/terminal/TextStyle.java +++ b/terminal-emulator/src/main/java/com/termux/terminal/TextStyle.java @@ -1,10 +1,13 @@ package com.termux.terminal; /** + *
* Encodes effects, foreground and background colors into a 64 bit long, which are stored for each cell in a terminal * row in {@link TerminalRow#mStyle}. - *
+ * + ** The bit layout is: + *
* - 16 flags (11 currently used). * - 24 for foreground color (only 9 first bits if a color index). * - 24 for background color (only 9 first bits if a color index). @@ -20,9 +23,10 @@ public final class TextStyle { public final static int CHARACTER_ATTRIBUTE_STRIKETHROUGH = 1 << 6; /** * The selective erase control functions (DECSED and DECSEL) can only erase characters defined as erasable. - * + ** This bit is set if DECSCA (Select Character Protection Attribute) has been used to define the characters that * come after it as erasable from the screen. + *
*/ public final static int CHARACTER_ATTRIBUTE_PROTECTED = 1 << 7; /** Dim colors. Also known as faint or half intensity. */