Read description for info

# Commits from Termux for Terminal backend

##  Implement CSI 3 J - Clear transcript
* 2a36b915cb

## Avoid joining lines for shared transcript
* 370ac2bd89

* All of this is needed so our terminal backend is up to date and works as needed
* If theres better method to give credit then lemme know.
This commit is contained in:
Martin Valba 2023-01-08 20:42:34 +02:00
parent a9ec59f0af
commit 85647b14e7
3 changed files with 14 additions and 3 deletions

View File

@ -49,7 +49,15 @@ public final class TerminalBuffer {
return getSelectedText(0, -getActiveTranscriptRows(), mColumns, mScreenRows).trim();
}
public String getTranscriptTextWithoutJoinedLines() {
return getSelectedText(0, -getActiveTranscriptRows(), mColumns, mScreenRows, false).trim();
}
public String getSelectedText(int selX1, int selY1, int selX2, int selY2) {
return getSelectedText(selX1, selY1, selX2, selY2, true);
}
public String getSelectedText(int selX1, int selY1, int selX2, int selY2, boolean joinBackLines) {
final StringBuilder builder = new StringBuilder();
final int columns = mColumns;
@ -87,7 +95,8 @@ public final class TerminalBuffer {
}
if (lastPrintingCharIndex != -1)
builder.append(line, x1Index, lastPrintingCharIndex - x1Index + 1);
if (!rowLineWrap && row < selY2 && row < mScreenRows - 1) builder.append('\n');
if ((!joinBackLines || !rowLineWrap)
&& row < selY2 && row < mScreenRows - 1) builder.append('\n');
}
return builder.toString();
}

View File

@ -1528,7 +1528,7 @@ public final class TerminalEmulator {
case 'I': // Cursor Horizontal Forward Tabulation (CHT). Move the active position n tabs forward.
setCursorCol(nextTabStop(getArg0(1)));
break;
case 'J': // "${CSI}${0,1,2}J" - Erase in Display (ED)
case 'J': // "${CSI}${0,1,2,3}J" - Erase in Display (ED)
// ED ignores the scrolling margins.
switch (getArg0(0)) {
case 0: // Erase from the active position to the end of the screen, inclusive (default).

View File

@ -469,9 +469,11 @@ public final class TerminalView extends View {
isScreenHeld = true;
}
int rowsInHistory = mEmulator.getScreen().getActiveTranscriptRows();
if (mTopRow < -rowsInHistory) mTopRow = -rowsInHistory;
if (mIsSelectingText || isScreenHeld) {
// Do not scroll when selecting text.
int rowsInHistory = mEmulator.getScreen().getActiveTranscriptRows();
int rowShift = mEmulator.getScrollCounter();
if (-mTopRow + rowShift > rowsInHistory) {
// .. unless we're hitting the end of history transcript, in which