Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(agentic-ide): stop an unscrolled pane reserving a strip of empty space

Ruben Lütke8e585c374286
diff --git a/jarvis/ui/web/frontend/src/components/agentic/PaneScrollbar.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/PaneScrollbar.test.tsx
index bebf07c2e3..020d1a1e78 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/PaneScrollbar.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/PaneScrollbar.test.tsx
@@ -161,14 +161,13 @@ describe("PaneScrollbar", () => {
});
/*
- * The reported bug, at the level a user meets it. Alternate screen + mouse
- * tracking means the terminal holds no scrollback to read a position from —
- * and a pane showing the agent's newest output must still draw its thumb at
- * the BOTTOM. It used to draw a short bright marking halfway up the track,
- * which reads as "you are in the middle" to everyone who has ever used a
- * scrollbar.
+ * The second report on this strip, at the level a user meets it. Reaching for
+ * the right edge of a Claude Code pane nobody has scrolled must reveal NOTHING:
+ * no measurement has been taken, so there is no history to describe, and the
+ * bar that used to appear here spent half its track on empty space — on every
+ * pane of a workspace that was just opened.
*/
- it("puts a Claude-Code-style pane's thumb at the live end", () => {
+ it("shows nothing on a Claude-Code-style pane nobody has scrolled", () => {
render(
<Harness
term={
@@ -183,11 +182,50 @@ describe("PaneScrollbar", () => {
reachForTheBar();
- expect(screen.getByTestId("pane-scrollbar-Dana").dataset.mode).toBe("app");
- expect(thumbTop() + thumbHeight()).toBe(TRACK_PX);
- // And nothing is drawn on the thumb that could be read as a position of
- // its own.
- expect(screen.queryByTestId("pane-scrollbar-grip-Dana")).toBeNull();
+ expect(screen.queryByTestId("pane-scrollbar-Dana")).toBeNull();
+ });
+
+ /*
+ * The FIRST reported bug, which the silence above must not undo: once the pane
+ * has been scrolled and brought back to the agent's newest output, its thumb
+ * sits at the BOTTOM. It used to draw a short bright marking halfway up the
+ * track, which reads as "you are in the middle" to everyone who has ever used
+ * a scrollbar.
+ */
+ it("puts a scrolled pane's thumb at the live end once it returns there", () => {
+ vi.useFakeTimers();
+ try {
+ const pane = fakeTerminal({
+ type: "alternate",
+ length: 24,
+ mouseTrackingMode: "any",
+ });
+ render(<Harness term={pane.term} />);
+ reachForTheBar();
+
+ // Back four lines into the history, then all the way home again.
+ fireEvent.wheel(document.querySelector(".xterm-screen")!, {
+ deltaY: -1,
+ deltaMode: 1,
+ });
+ pane.show([...transcript(-3, 4), ...transcript(1, 20)]);
+ act(() => vi.advanceTimersByTime(SETTLE_MS));
+
+ fireEvent.wheel(document.querySelector(".xterm-screen")!, {
+ deltaY: 1,
+ deltaMode: 1,
+ });
+ pane.show(transcript(1, 24));
+ act(() => vi.advanceTimersByTime(SETTLE_MS));
+
+ expect(screen.getByTestId("pane-scrollbar-Dana").dataset.mode).toBe("app");
+ expect(thumbTop() + thumbHeight()).toBe(TRACK_PX);
+ // And nothing is drawn on the thumb that could be read as a position of
+ // its own.
+ expect(screen.queryByTestId("pane-scrollbar-grip-Dana")).toBeNull();
+ } finally {
+ vi.useRealTimers();
+ }
});
/*
@@ -205,7 +243,6 @@ describe("PaneScrollbar", () => {
});
render(<Harness term={pane.term} />);
reachForTheBar();
- const atLiveEnd = thumbTop();
fireEvent.wheel(document.querySelector(".xterm-screen")!, {
deltaY: -1,
@@ -214,7 +251,9 @@ describe("PaneScrollbar", () => {
pane.show([...transcript(-3, 4), ...transcript(1, 20)]);
act(() => vi.advanceTimersByTime(SETTLE_MS));
- expect(thumbTop()).toBeLessThan(atLiveEnd);
+ // The measurement is what brings the bar into the document at all, and it
+ // arrives already showing the position it measured: above the live end.
+ expect(thumbTop() + thumbHeight()).toBeLessThan(TRACK_PX);
expect(screen.getByTestId("pane-scrollbar-Dana").dataset.shown).toBe(
"true",
);
@@ -251,29 +290,41 @@ describe("PaneScrollbar", () => {
});
it("hands wheel turns over the bar to the CLI that owns the screen", () => {
- render(
- <Harness
- term={
- fakeTerminal({
- type: "alternate",
- length: 24,
- mouseTrackingMode: "any",
- }).term
- }
- />,
- );
- reachForTheBar();
+ vi.useFakeTimers();
+ try {
+ const pane = fakeTerminal({
+ type: "alternate",
+ length: 24,
+ mouseTrackingMode: "any",
+ });
+ render(<Harness term={pane.term} />);
+ reachForTheBar();
- const relayed: number[] = [];
- document
- .querySelector(".xterm-screen")!
- .addEventListener("wheel", (event) =>
- relayed.push((event as WheelEvent).deltaY),
- );
+ // One measured notch, purely to bring the bar into the document: an
+ // app-mode pane nothing has been measured on draws none, so there would be
+ // nothing to turn a wheel over.
+ fireEvent.wheel(document.querySelector(".xterm-screen")!, {
+ deltaY: -1,
+ deltaMode: 1,
+ });
+ pane.show([...transcript(-3, 4), ...transcript(1, 20)]);
+ act(() => vi.advanceTimersByTime(SETTLE_MS));
- fireEvent.wheel(screen.getByTestId("pane-scrollbar-Dana"), { deltaY: 120 });
+ const relayed: number[] = [];
+ document
+ .querySelector(".xterm-screen")!
+ .addEventListener("wheel", (event) =>
+ relayed.push((event as WheelEvent).deltaY),
+ );
+
+ fireEvent.wheel(screen.getByTestId("pane-scrollbar-Dana"), {
+ deltaY: 120,
+ });
- expect(relayed).toEqual([1, 1, 1]);
+ expect(relayed).toEqual([1, 1, 1]);
+ } finally {
+ vi.useRealTimers();
+ }
});
it("scrolls the viewport itself when the terminal holds the history", () => {
diff --git a/jarvis/ui/web/frontend/src/components/agentic/PaneScrollbar.tsx b/jarvis/ui/web/frontend/src/components/agentic/PaneScrollbar.tsx
index 1b85c5ffd6..0468b389f3 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/PaneScrollbar.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/PaneScrollbar.tsx
@@ -19,6 +19,16 @@
* The bar is an overlay, not a layout box: xterm reserves a gutter on the right
* for the scrollbar it thinks it has, and the bar sits in that gutter, so
* nothing is drawn underneath it.
+ *
+ * That gutter is real even though ./index.css gives the native bar zero width.
+ * Measured against xterm 5.5.0, `Viewport` computes
+ * `scrollBarWidth = viewportElement.offsetWidth - scrollArea.offsetWidth || 15`
+ * — and a scrollbar hidden by CSS makes that difference 0, so the `|| 15`
+ * fallback takes over and `FitAddon.proposeDimensions` drops 15 px of columns.
+ * Hence `GUTTER_PX`: the bar is placed flush against the terminal host's right
+ * edge, INSIDE the reserved strip. Floating it in the pane's own padding instead
+ * (the original `right-1`) left dead space on both sides of it — part of the
+ * empty right-hand strip reported on 2026-07-27.
*/
import {
useCallback,
@@ -48,6 +58,18 @@ import {
/** How close to the pane's right edge the pointer reveals the bar. */
const HOT_ZONE_PX = 28;
+/**
+ * How far the bar sits from the pane's right edge.
+ *
+ * Equal to the terminal region's own horizontal padding (`px-2` in
+ * ./AgenticTerminal), which lands the bar flush against the xterm host's right
+ * edge — the near side of the gutter xterm reserves for the scrollbar it thinks
+ * it has (see the file header). The earlier `right-1` put it 4 px from the
+ * region edge instead, i.e. half in the pane's visual padding, with dead space
+ * on both sides of it.
+ */
+const BAR_INSET_PX = 8;
+
/** Grace period before a bar the pointer left disappears again. */
const HIDE_DELAY_MS = 260;
@@ -408,10 +430,11 @@ export function PaneScrollbar({
onWheel={onWheel}
onMouseDown={(event) => event.stopPropagation()}
className={cn(
- "absolute bottom-1 right-1 top-1 z-10 w-[10px] rounded-full transition-opacity duration-150",
+ "absolute bottom-1 top-1 z-10 w-[10px] rounded-full transition-opacity duration-150",
shown ? "opacity-100" : "pointer-events-none opacity-0",
)}
style={{
+ right: BAR_INSET_PX,
background: shown
? light
? "rgba(0,0,0,0.06)"
diff --git a/jarvis/ui/web/frontend/src/components/agentic/paneAppScroll.test.ts b/jarvis/ui/web/frontend/src/components/agentic/paneAppScroll.test.ts
index 653e7553ea..eab93f0f2e 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/paneAppScroll.test.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/paneAppScroll.test.ts
@@ -9,6 +9,7 @@ import {
appTakesWheel,
applyShift,
detectShift,
+ hasMeasuredHistory,
notchesForLines,
trackAppScroll,
visibleRows,
@@ -218,14 +219,44 @@ describe("applyShift", () => {
});
});
+describe("hasMeasuredHistory", () => {
+ it("knows nothing about a pane nobody has scrolled", () => {
+ expect(hasMeasuredHistory(AT_LIVE_END)).toBe(false);
+ });
+
+ /*
+ * The three ways something can be known, each on its own — because each is a
+ * pane the user has already scrolled, and one that must keep the bar it was
+ * scrolled with even after coming home to the newest output.
+ */
+ it("knows something once the pane has been away from the live end", () => {
+ expect(hasMeasuredHistory({ ...AT_LIVE_END, offset: 4 })).toBe(true);
+ });
+
+ it("knows something once a depth has been reached", () => {
+ expect(hasMeasuredHistory({ ...AT_LIVE_END, span: 40 })).toBe(true);
+ });
+
+ /*
+ * Including the pane measured as having NO history at all: something IS known
+ * about it, and what `readScrollState` does with that is take the bar away —
+ * for a reason of its own, not for want of a measurement.
+ */
+ it("knows something once a scroll has hit the top", () => {
+ expect(hasMeasuredHistory({ ...AT_LIVE_END, spanKnown: true })).toBe(true);
+ });
+});
+
describe("appScrollExtent", () => {
/*
- * Before anybody has scrolled, the size of the history is unknown but the
- * position is not: the application is showing its newest output. So the thumb
- * rests at the BOTTOM — which is the reading the reported bug was missing —
- * and is sized by an assumed screenful above it.
+ * The arithmetic for a position whose top is still unfound: one screenful is
+ * assumed above the deepest point reached, and the viewport sits at the bottom
+ * of it. Note this is the arithmetic ONLY — whether a bar is drawn at all is
+ * `hasMeasuredHistory`'s call, and for an untouched pane the answer is no (see
+ * `readScrollState` in ./paneScroll). Kept as a unit so the "top unknown" case
+ * that DOES reach the screen — scrolled back, top not yet hit — stays pinned.
*/
- it("puts an unscrolled pane at the bottom of its track", () => {
+ it("assumes one screen above a position whose top is unfound", () => {
expect(appScrollExtent(AT_LIVE_END, 30)).toEqual({ total: 60, top: 30 });
});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/paneAppScroll.ts b/jarvis/ui/web/frontend/src/components/agentic/paneAppScroll.ts
index a8d9131dd9..dba2309ef4 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/paneAppScroll.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/paneAppScroll.ts
@@ -40,14 +40,25 @@
*
* ## What it is honest about
*
- * Before anyone has scrolled, the extent of the history is genuinely unknown —
- * so it is treated as "at least one more screen above", which draws a half-track
- * thumb resting at the BOTTOM. That is a claim about size, made openly and
- * corrected by the first real measurement; it is not a claim about position, and
- * the position it does show — you are at the newest output — is the true one.
- * A full-screen application with no history at all (a dashboard, a pager on a
- * short file) reveals itself on the first scroll attempt that moves nothing, and
- * its pane loses the bar entirely.
+ * Before anyone has scrolled, NOTHING about the history is known — not its
+ * extent and not whether it exists at all — and a bar is drawn only once
+ * something has actually been measured ({@link hasMeasuredHistory}).
+ *
+ * That rule replaces an assumption. An untouched pane used to be credited with
+ * "at least one more screen above", which put a half-track thumb at the bottom
+ * of the track — and the other half of the track was then empty furniture down
+ * the side of every pane that nobody had scrolled yet, which is every pane in a
+ * fresh workspace (reported 2026-07-27, second round on the same strip). The
+ * assumed screenful was not measured, so the empty half was paying for a claim
+ * this module had no evidence for.
+ *
+ * Once a wheel notch HAS been measured the extent is real, and the arithmetic
+ * below applies as before: while the top is still unfound one more screen is
+ * assumed above the deepest point reached, which is a claim about size only —
+ * openly made, corrected by the next measurement, and never a claim about
+ * position. A full-screen application with no history at all (a dashboard, a
+ * pager on a short file) reveals itself on the first scroll attempt that moves
+ * nothing, and its pane keeps no bar either.
*/
import type { Terminal } from "@xterm/xterm";
@@ -86,6 +97,24 @@ export const AT_LIVE_END: AppScrollPosition = {
linesPerNotch: 1,
};
+/**
+ * Has anything about this pane's history actually been measured yet?
+ *
+ * The gate between "we know nothing" and "we know something", and the reason a
+ * fresh pane draws no bar at all — see the file header. Any one of the three is
+ * enough: the user is standing away from the live end, a depth has been reached
+ * at some point, or a scroll towards older output ran into the top.
+ *
+ * Deliberately a property of the VALUE rather than an identity check against
+ * {@link AT_LIVE_END}. A position that travelled back into the history and
+ * returned to the newest output is no longer that constant, but it has learned
+ * that the history exists — and a pane the user has already scrolled once must
+ * keep the bar they scrolled it with.
+ */
+export function hasMeasuredHistory(position: AppScrollPosition): boolean {
+ return position.spanKnown || position.span > 0 || position.offset > 0;
+}
+
/**
* Fewest recognisable rows two screens need before they may be compared.
*
diff --git a/jarvis/ui/web/frontend/src/components/agentic/paneScroll.test.ts b/jarvis/ui/web/frontend/src/components/agentic/paneScroll.test.ts
index 8d6775a6f5..6cf34649d5 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/paneScroll.test.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/paneScroll.test.ts
@@ -99,17 +99,35 @@ describe("readScrollState", () => {
});
/*
- * The reported bug, in one assertion. A pane showing an agent's newest output
- * must draw its thumb AT THE BOTTOM — even before anyone has scrolled it, when
- * the size of the history is still unknown.
+ * The follow-up report on the same strip: a pane nobody has scrolled yet gets
+ * NO bar. It used to be credited with an assumed screenful of history, which
+ * sized a half-track thumb and left the other half as empty furniture down the
+ * side of every pane in a freshly opened workspace.
*/
- it("puts an unscrolled app-mode pane at the live end", () => {
+ it("draws no bar for an app-mode pane nothing has been measured on", () => {
const state = readScrollState(
fakeTerminal({ type: "alternate", mouseTrackingMode: "any", rows: 30 }),
AT_LIVE_END,
);
+
+ expect(state.mode).toBe("none");
+ expect(thumbGeometry(state, 300)).toBeNull();
+ });
+
+ /*
+ * And the moment there IS a measurement, the pane showing the agent's newest
+ * output draws its thumb AT THE BOTTOM — the original reported bug, which the
+ * gate above must not quietly undo. `span` without `offset` is a pane that
+ * travelled back through the history and came home to the live end.
+ */
+ it("puts a measured app-mode pane at the live end", () => {
+ const state = readScrollState(
+ fakeTerminal({ type: "alternate", mouseTrackingMode: "any", rows: 30 }),
+ measured({ offset: 0, span: 90, spanKnown: true }),
+ );
const geometry = thumbGeometry(state, 300)!;
+ expect(state.mode).toBe("app");
expect(geometry.topPx + geometry.heightPx).toBe(300);
});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/paneScroll.ts b/jarvis/ui/web/frontend/src/components/agentic/paneScroll.ts
index 53d2bb5e2f..c4c7012621 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/paneScroll.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/paneScroll.ts
@@ -47,9 +47,9 @@
* * `app` — the application took the mouse, so it holds the history (Claude
* Code). Position and extent are MEASURED from how far the screen's content
* moves when it is scrolled — see ./paneAppScroll.
- * * `none` — nothing to scroll (a fresh pane, or a full-screen app measured as
- * having no history at all). The bar stays away instead of drawing a dead
- * track.
+ * * `none` — nothing to scroll, or nothing measured yet: a fresh pane, an
+ * application nobody has scrolled, or one measured as having no history at
+ * all. The bar stays away instead of drawing a dead track.
*
* ## Both modes draw the same thumb, because both now know the same things
*
@@ -69,12 +69,22 @@
* only thing still specific to `app` mode is HOW a drag is carried out —
* relayed wheel notches instead of a viewport call — because that is the only
* language the application listens in.
+ *
+ * ## And it says nothing until it has measured something
+ *
+ * A real answer is only available once there has been something to measure. Until
+ * then `app` mode draws NO bar, rather than sizing one from an assumed screenful
+ * of history: that assumption left half the track empty on every pane nobody had
+ * scrolled yet — which, in a workspace that was just opened, is all of them.
+ * Reported 2026-07-27 as a strip of empty space down the right-hand side of a
+ * pane, on the same edge as the position bug above and immediately after it.
*/
import type { Terminal } from "@xterm/xterm";
import {
appScrollExtent,
appTakesWheel,
AT_LIVE_END,
+ hasMeasuredHistory,
type AppScrollPosition,
} from "./paneAppScroll";
@@ -138,6 +148,13 @@ export function readScrollState(
// holds the history with it, in EITHER buffer, so the viewport it left behind
// is ignored in favour of what the measurement found.
if (appTakesWheel(term)) {
+ // Nothing measured yet, so there is nothing to draw. An application that
+ // holds its own history does not reveal how much of it there is until it is
+ // scrolled, and a bar sized from an ASSUMED screenful spends half its track
+ // on empty furniture — down the side of every pane in a fresh workspace,
+ // because a pane nobody has scrolled yet is the normal state of one. See
+ // `hasMeasuredHistory` in ./paneAppScroll.
+ if (!hasMeasuredHistory(position)) return IDLE_STATE;
const extent = appScrollExtent(position, rows);
// A measurement that found no history at all — a dashboard, a pager on a
// short file — takes the bar away rather than drawing a thumb that fills