Added: Add SCROLL extra key to toggle auto scrolling of terminal to bottom on terminal text updates and termux activity return

The toggle will apply to each terminal session separately.

Closes #2535
This commit is contained in:
agnostic-apollo
2022-06-18 06:58:44 +05:00
parent a2df7d791a
commit 5fc2b4cd4a
4 changed files with 30 additions and 3 deletions

View File

@@ -409,19 +409,29 @@ public final class TerminalView extends View {
}
public void onScreenUpdated() {
onScreenUpdated(false);
}
public void onScreenUpdated(boolean skipScrolling) {
if (mEmulator == null) return;
int rowsInHistory = mEmulator.getScreen().getActiveTranscriptRows();
if (mTopRow < -rowsInHistory) mTopRow = -rowsInHistory;
boolean skipScrolling = false;
if (isSelectingText()) {
if (isSelectingText() || mEmulator.isAutoScrollDisabled()) {
// Do not scroll when selecting text.
int rowShift = mEmulator.getScrollCounter();
if (-mTopRow + rowShift > rowsInHistory) {
// .. unless we're hitting the end of history transcript, in which
// case we abort text selection and scroll to end.
stopTextSelectionMode();
if (isSelectingText())
stopTextSelectionMode();
if (mEmulator.isAutoScrollDisabled()) {
mTopRow = -rowsInHistory;
skipScrolling = true;
}
} else {
skipScrolling = true;
mTopRow -= rowShift;