Fix scrolling in Terminal

This commit is contained in:
James Babcock committed 2026-07-24 01:52:12 -07:00
1 parent 8ffccad7f0
commit d42e11e2a5
7 files changed
+90 -63

No files matched your search

+2 -7
View File
@@ -8,7 +8,7 @@ import {
GESTURE_SCROLL,
} from "../gestures";
import { DashboardInputEvent, Layer, LayerActions, LayerContext } from "../layers";
import { drawSelectionHighlight } from "../menu";
import { drawSelectionHighlight, scrollToKeepSelectionVisible } from "../menu";
import { createInProcessWindow } from "./in-process-window";
import { shell, type ShellWindow } from "./shell";
@@ -89,12 +89,7 @@ class LauncherGridLayer implements Layer {
const colW = width / COLS;
// Scroll to keep the selected row among the fully-visible rows.
if (this.selectedRow < this.scrollRow) {
this.scrollRow = this.selectedRow;
} else if (this.selectedRow > this.scrollRow + FULL_ROWS - 1) {
this.scrollRow = this.selectedRow - (FULL_ROWS - 1);
}
this.scrollRow = clamp(this.scrollRow, 0, Math.max(0, rows - FULL_ROWS));
this.scrollRow = scrollToKeepSelectionVisible(this.scrollRow, this.selectedRow, FULL_ROWS, rows);
const rowY = (row: number) => GRID_TOP + (row - this.scrollRow) * rowH;