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): make the terminal scroll rail an honest controller for TUI-owned history

rubenluetke10-beepc982be473a47
diff --git a/jarvis/ui/web/frontend/src/components/agentic/PaneScrollRail.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/PaneScrollRail.test.tsx
index 9198915dc2..fce099faf1 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/PaneScrollRail.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/PaneScrollRail.test.tsx
@@ -217,6 +217,55 @@ describe("PaneScrollRail", () => {
).toBe("terminal-Aria");
});
+ it("pages the application from the visible arrow caps", () => {
+ const harness = fakeTerminal({ owner: "mouse-app" });
+ render(<RailHarness name="Odo" term={harness.term} />);
+ giveTrackGeometry("Odo");
+ const deltas: number[] = [];
+ screen
+ .getByTestId("xterm-screen-Odo")
+ .addEventListener("wheel", (event) =>
+ deltas.push((event as WheelEvent).deltaY),
+ );
+
+ fireEvent.click(screen.getByRole("button", { name: "Scroll older in Odo" }));
+ expect(deltas.length).toBeGreaterThan(0);
+ expect(deltas.every((delta) => delta < 0)).toBe(true);
+
+ fireEvent.click(screen.getByRole("button", { name: "Scroll newer in Odo" }));
+ expect(deltas.some((delta) => delta > 0)).toBe(true);
+ });
+
+ it("notices a mouse-tracking flip that arrives without any buffer event", () => {
+ vi.useFakeTimers({
+ toFake: [
+ "setInterval",
+ "clearInterval",
+ "requestAnimationFrame",
+ "cancelAnimationFrame",
+ ],
+ });
+ try {
+ const harness = fakeTerminal({ owner: "terminal" });
+ render(<RailHarness name="Vera" term={harness.term} />);
+ const rail = screen.getByTestId("pane-scroll-rail-Vera");
+ expect(rail.dataset.scrollMode).toBe("terminal");
+
+ // A replayed session consumes the TUI's DECSET before the rail
+ // subscribes, so the flip reaches xterm without any later event.
+ (
+ harness.term.modes as { mouseTrackingMode: string }
+ ).mouseTrackingMode = "any";
+ act(() => {
+ vi.advanceTimersByTime(1600);
+ });
+
+ expect(rail.dataset.scrollMode).toBe("application");
+ } finally {
+ vi.useRealTimers();
+ }
+ });
+
it("restores the current owner geometry when a TUI starts during a drag", () => {
const harness = fakeTerminal({ owner: "terminal", line: 50 });
render(<RailHarness name="Iris" term={harness.term} />);
diff --git a/jarvis/ui/web/frontend/src/components/agentic/PaneScrollRail.tsx b/jarvis/ui/web/frontend/src/components/agentic/PaneScrollRail.tsx
index 6d85f7b07b..18fd5dac1a 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/PaneScrollRail.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/PaneScrollRail.tsx
@@ -2,10 +2,12 @@
* One honest scroll rail for one Agentic-IDE terminal pane.
*
* Normal terminal history gets a conventional absolute thumb. Full-screen
- * coding TUIs keep their history inside the application, so their thumb is a
- * centred controller: drag it up or down and the application receives its own
- * standard wheel protocol. It springs back on release because claiming an
- * absolute position there would be a guess.
+ * coding TUIs keep their history inside the application, so no absolute
+ * position exists to draw; instead of a thumb pretending to be one, the rail
+ * becomes a visible controller — arrow caps that page the application and a
+ * grip that relays drags as the application's own wheel protocol. The grip
+ * springs back to centre on release because claiming a position would be a
+ * guess.
*/
import {
useCallback,
@@ -121,6 +123,16 @@ export function PaneScrollRail({
};
}, [epoch, scheduleSync, sync, terminalRef]);
+ useEffect(() => {
+ // A replayed session can hand this rail a terminal whose mouse-tracking
+ // DECSET was parsed before the subscriptions above existed, and a TUI can
+ // flip tracking without emitting anything else afterwards. Observed live:
+ // panes stuck on "no history" while the application was already scrolling.
+ // A slow poll is the safety net; sameView keeps it render-free.
+ const timer = window.setInterval(scheduleSync, 750);
+ return () => window.clearInterval(timer);
+ }, [scheduleSync]);
+
useEffect(() => {
const region = regionRef.current;
if (!region) return;
@@ -423,18 +435,34 @@ export function PaneScrollRail({
<>
<button
type="button"
- className="sr-only"
aria-label={`Scroll older in ${name}`}
aria-controls={controlsId}
+ onPointerDown={(event) => event.stopPropagation()}
onClick={() => scrollApplicationPage(-1)}
- />
+ className={cn(
+ "absolute inset-x-0 top-0 flex h-4 items-start justify-center rounded-t-full pt-1",
+ "text-[#e7c46e]/70 outline-none hover:text-[#e7c46e] focus-visible:text-[#e7c46e]",
+ )}
+ >
+ <svg viewBox="0 0 8 5" className="h-[5px] w-2 fill-current" aria-hidden="true">
+ <path d="M4 0 8 5H0Z" />
+ </svg>
+ </button>
<button
type="button"
- className="sr-only"
aria-label={`Scroll newer in ${name}`}
aria-controls={controlsId}
+ onPointerDown={(event) => event.stopPropagation()}
onClick={() => scrollApplicationPage(1)}
- />
+ className={cn(
+ "absolute inset-x-0 bottom-0 flex h-4 items-end justify-center rounded-b-full pb-1",
+ "text-[#e7c46e]/70 outline-none hover:text-[#e7c46e] focus-visible:text-[#e7c46e]",
+ )}
+ >
+ <svg viewBox="0 0 8 5" className="h-[5px] w-2 fill-current" aria-hidden="true">
+ <path d="M4 5 0 0h8Z" />
+ </svg>
+ </button>
</>
)}
<div
@@ -442,13 +470,25 @@ export function PaneScrollRail({
data-pane-scroll-thumb="true"
data-testid={`pane-scroll-thumb-${name}`}
className={cn(
- "absolute right-[3px] w-1.5 rounded-full bg-[#e7c46e]/65",
+ "absolute rounded-full bg-[#e7c46e]/65",
+ exact ? "right-[3px] w-1.5" : "right-[2px] w-2",
"shadow-[0_0_0_1px_rgba(0,0,0,0.18)] transition-[background-color,top]",
"group-hover:bg-[#e7c46e]/90 group-focus-visible:bg-[#e7c46e]/90",
dragging && "bg-[#e7c46e] transition-none",
)}
style={{ top: geometry.top, height: geometry.height }}
- />
+ >
+ {!exact && (
+ <span
+ aria-hidden="true"
+ className="pointer-events-none absolute inset-x-0 top-1/2 flex -translate-y-1/2 flex-col items-center gap-[3px]"
+ >
+ <span className="h-[2px] w-[2px] rounded-full bg-[#141414]/70" />
+ <span className="h-[2px] w-[2px] rounded-full bg-[#141414]/70" />
+ <span className="h-[2px] w-[2px] rounded-full bg-[#141414]/70" />
+ </span>
+ )}
+ </div>
</div>
);
}