A self-improving RLM agent for coding workflows and long-running autonomous tasks.
Rust
Allow copying fullscreen dock text (#342)
Seth Karten4124de64e294
diff --git a/packages/tui/CHANGELOG.md b/packages/tui/CHANGELOG.mdindex 84bf825407..6fcd6d9372 100644--- a/packages/tui/CHANGELOG.md+++ b/packages/tui/CHANGELOG.md@@ -2,6 +2,8 @@## [Unreleased]+- Fixed fullscreen dock selection so prompt text can be copied ([#342](https://github.com/PrimeIntellect-ai/prime-agent/pull/342)).+## [0.2.8] - 2026-07-09## [0.2.7] - 2026-07-08diff --git a/packages/tui/src/tui.ts b/packages/tui/src/tui.tsindex 99e4863b59..159fdf5c2c 100644--- a/packages/tui/src/tui.ts+++ b/packages/tui/src/tui.ts@@ -814,7 +814,9 @@ export class TUI extends Container {} else if (isWheelDown(event)) {this.scrollBy(TUI.WHEEL_SCROLL_LINES);} else if (event.button === MOUSE_BUTTON_LEFT && event.press && !event.motion) {- viewport.beginSelection(event.y - 1, event.x - 1);+ if (!viewport.beginSelection(event.y - 1, event.x - 1)) {+ viewport.beginFrameSelection(event.y - 1, event.x - 1);+ }this.requestRender();} else if (event.button === MOUSE_BUTTON_LEFT && event.press && event.motion) {viewport.extendActiveSelection(event.y - 1, event.x - 1);@@ -1031,7 +1033,7 @@ export class TUI extends Container {private compositeOverlays(lines: string[], termWidth: number, termHeight: number): string[] {if (this.overlayStack.length === 0) return lines;const result = [...lines];- const overlaySelectionRegions: FrameSelectionRegion[] = [];+ const overlaySelectionRegions: FrameSelectionRegion[] = [...this.overlaySelectionRegions];// Pre-render all visible overlays and calculate positionsconst rendered: {@@ -1118,6 +1120,21 @@ export class TUI extends Container {return from === -1 ? null : { from, to };}+ private createDockSelectionRegions(+ frame: string[],+ transcriptWindowHeight: number,+ width: number,+ ): FrameSelectionRegion[] {+ const regions: FrameSelectionRegion[] = [];+ for (let row = Math.max(0, transcriptWindowHeight); row < frame.length; row++) {+ const span = this.selectableSpan(frame[row] ?? "", width);+ if (span) {+ regions.push({ line: row, col: span.from, width: span.to - span.from });+ }+ }+ return regions;+ }+private subtractSelectionCoverage(regions: FrameSelectionRegion[],line: number,@@ -1293,6 +1310,9 @@ export class TUI extends Container {const dock = fullscreen.dock.render(width);let frame = fullscreen.viewport.composeFrame(transcript, dock, height);+ this.overlaySelectionRegions.push(+ ...this.createDockSelectionRegions(frame, fullscreen.viewport.windowHeight(), width),+ );const scrollInfo = fullscreen.viewport.scrollInfo();if (fullscreen.viewportControls && !scrollInfo.following) {// Follow hint composited over the bottom of the transcript window,diff --git a/packages/tui/test/fullscreen.test.ts b/packages/tui/test/fullscreen.test.tsindex d51e6a635b..743595f478 100644--- a/packages/tui/test/fullscreen.test.ts+++ b/packages/tui/test/fullscreen.test.ts@@ -578,6 +578,26 @@ describe("TUI fullscreen mode", () => {tui.stop();});+ it("drag-selecting dock text copies from the user input area", async () => {+ const { terminal, tui, chat, dock } = setup(lines(20));+ const copies: string[] = [];+ tui.onCopy = (text) => copies.push(text);+ tui.enterFullscreen({ scroll: [chat], dock });+ await terminal.waitForRender();++ // rows=10 and dock=2, so the user prompt is visible at screen row 9.+ terminal.sendInput("\x1b[<0;3;9M");+ terminal.sendInput("\x1b[<32;9;9M");+ await terminal.waitForRender();+ assert.ok(terminal.getWrites().includes("\x1b[7m"), "dock selection highlighted while dragging");++ terminal.sendInput("\x1b[<0;9;9m");+ await terminal.waitForRender();+ assert.deepStrictEqual(copies, ["prompt"]);++ tui.stop();+ });+it("writes OSC 52 when no copy handler is set", async () => {const { terminal, tui, chat, dock } = setup(lines(20));tui.enterFullscreen({ scroll: [chat], dock });