diff --git a/src/ui/ThreadView.tsx b/src/ui/ThreadView.tsx
index f58d4c1..c62c669 100644
--- a/src/ui/ThreadView.tsx
+++ b/src/ui/ThreadView.tsx
@@ -17,7 +17,7 @@ import { BAR } from "./edges.ts";
import type { T3Session, ThreadHistory } from "../client/session.ts";
import { liveWorkEntryLabel, workEntryDisplayLabel, type MessagesTimelineRow, type Timeline, type WorkLogEntry } from "../model/timeline.ts";
import { blockFor } from "../model/transcript.ts";
-import { firstLine, truncate } from "./text.ts";
+import { firstLine } from "./text.ts";
import { colors, scrollbarOptions, toneColor, useMarkdownStyle } from "./theme.ts";
/** What a right-click in the conversation was on. */
@@ -39,9 +39,6 @@ export interface ConversationMouse {
readonly click: (x: number, y: number) => void;
}
-/** Prose stops at this width on wide terminals, left-aligned. */
-const CONTENT_WIDTH = 100;
-
/** The conversation, row for row as the web app derives it (MessagesTimeline.logic). */
export function ThreadView(props: {
readonly timeline: Timeline | null;
@@ -75,8 +72,7 @@ export function ThreadView(props: {
) : null}
{props.error ? {props.error} : null}
- {/* Prose stops at reading width on wide terminals; the composer below stays full width. */}
-
+
{props.loading && !timeline ? Loading… : null}
{history?.hasMore || history?.error ? : null}
{timeline?.rows.filter((row) => !isPendingApprovalRow(row, pendingIds)).map((row) => (
@@ -284,10 +280,9 @@ function ChangedFiles({ summary, onOpenTurnDiff }: { readonly summary: ThreadChe
function ChangedFile({ path, additions, deletions, onPress }: { readonly path: string; readonly additions: number; readonly deletions: number; readonly onPress: () => void }) {
const [hover, hoverProps] = useHover();
- const counts = (additions > 0 ? `+${additions}`.length : 0) + (deletions > 0 ? `−${deletions}`.length : 0) + (additions > 0 && deletions > 0 ? 1 : 0);
return (
isLeftClick(event) && onPress()}>
- {truncate(path, CONTENT_WIDTH - 2 - (counts ? counts + 2 : 0))}
+ {path}
@@ -326,13 +321,14 @@ function UserMessage({ session, text, attachments, messageId, selected, onSelect
);
}
+const IMAGE_COLUMNS = 100;
const IMAGE_ROWS = 12;
/** A sent image, shown in the terminal's best image protocol; its name alone until it loads, or if it can't. */
function MessageImage({ session, attachment }: { readonly session: T3Session; readonly attachment: ChatAttachment }) {
const [bytes, setBytes] = useState(null);
const [failed, setFailed] = useState(false);
- const [size, setSize] = useState({ width: CONTENT_WIDTH, height: IMAGE_ROWS });
+ const [size, setSize] = useState({ width: IMAGE_COLUMNS, height: IMAGE_ROWS });
const image = useRef(null);
useEffect(() => {
let cancelled = false;
@@ -356,7 +352,7 @@ function MessageImage({ session, attachment }: { readonly session: T3Session; re
width={size.width}
maxWidth="100%"
height={size.height}
- onLoad={() => image.current && setSize(image.current.getFittedSize(CONTENT_WIDTH, IMAGE_ROWS))}
+ onLoad={() => image.current && setSize(image.current.getFittedSize(IMAGE_COLUMNS, IMAGE_ROWS))}
onError={() => setFailed(true)}
/>
{name}
@@ -388,12 +384,10 @@ function OmittedOutput({ session, source }: { readonly session: T3Session; reado
/** One work/tool line, everywhere the same: glyph, label, result details right-aligned. */
function WorkLine(props: { readonly glyph: string; readonly glyphColor: string; readonly label: string; readonly labelColor: string; readonly detail?: string; readonly selectable?: boolean }) {
- // The label gives up whatever the right-hand details take, within the reading width.
- const label = truncate(props.label, CONTENT_WIDTH - 2 - (props.detail ? props.detail.length + 2 : 0));
return (
{`${props.glyph} `}
- {label}
+ {props.label.replace(/\s+/g, " ")}
{props.detail ? (
<>
diff --git a/test/app/app.test.tsx b/test/app/app.test.tsx
index c9f7553..f340f6d 100644
--- a/test/app/app.test.tsx
+++ b/test/app/app.test.tsx
@@ -1,7 +1,7 @@
import { afterEach, describe, expect, test } from "bun:test";
import type { OrchestrationV2ThreadProjection } from "@t3tools/contracts";
-import { omittedCommand, withApproval, withCompletedTurn, withOmittedOutput, withQuestion, withWorking } from "./fixtures.ts";
+import { omittedCommand, withApproval, withCompletedTurn, withOmittedOutput, withQuestion, withReply, withWorking } from "./fixtures.ts";
import { loadLayout } from "../../src/layout.ts";
import { fakeSession, renderApp, v2Projection, v2ThreadId } from "./harness.tsx";
@@ -151,6 +151,13 @@ describe("palette and pickers", () => {
});
describe("a finished turn", () => {
+ test("the conversation uses the whole width of a wide window", async () => {
+ const reply = Array.from({ length: 20 }, (_, index) => `word${index}`).join(" ");
+ const app = await open({ width: 240, height: 30, session: fakeSession({ projection: withReply(reply, false) }) });
+ const line = app.frame().split("\n").find((text) => text.includes("word0 "))!;
+ expect(line).toContain("word19");
+ });
+
test("its changed files fold out under the reply, and a file opens the turn's diff", async () => {
const patch = "diff --git a/src/index.ts b/src/index.ts\n--- a/src/index.ts\n+++ b/src/index.ts\n@@ -1 +1 @@\n-old\n+new\n";
const app = await open({ session: fakeSession({ projection: withCompletedTurn(), results: { turnDiff: { diff: patch } } }) });