pi-render-btw 0.6.3 → 0.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/extensions/btw-transcript.test.ts +40 -0
- package/extensions/btw.ts +5 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -114,12 +114,12 @@ pi install /path/to/pi-render-btw
|
|
|
114
114
|
### `/btw:peek`
|
|
115
115
|
|
|
116
116
|
- switches the BTW overlay into Peek mode for the current side thread
|
|
117
|
-
- `
|
|
117
|
+
- `Ctrl+P` enters Peek mode from the BTW composer, even when it contains a draft
|
|
118
118
|
- `j/k` scroll one message, `J/K` jump to the next/previous message, and `g/G` go to the top/bottom
|
|
119
119
|
- `/` searches with smartcase; `n/N` moves between matches
|
|
120
120
|
- `t` toggles tool messages
|
|
121
121
|
- `M` copies the selected message; `o` opens it read-only in nvim
|
|
122
|
-
- `Esc` returns to the BTW composer
|
|
122
|
+
- `Esc`, `q`, or `Ctrl+C` returns to the BTW composer; press `Esc` again in the composer to dismiss BTW
|
|
123
123
|
|
|
124
124
|
### `/btw:clear`
|
|
125
125
|
|
|
@@ -46,4 +46,44 @@ describe("BTW transcript message layout", () => {
|
|
|
46
46
|
expect(lines[0]).toBe(" Assistant ");
|
|
47
47
|
expect(lines[1].startsWith(" Response")).toBe(true);
|
|
48
48
|
});
|
|
49
|
+
|
|
50
|
+
it("opens Peek with Ctrl+P even when the composer contains a draft", () => {
|
|
51
|
+
const component = new BtwOverlayComponent(
|
|
52
|
+
tui,
|
|
53
|
+
theme,
|
|
54
|
+
keybindings,
|
|
55
|
+
() => [],
|
|
56
|
+
() => null,
|
|
57
|
+
() => "contextual",
|
|
58
|
+
() => {},
|
|
59
|
+
() => {},
|
|
60
|
+
() => {},
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
component.setDraft("draft prompt");
|
|
64
|
+
component.handleInput("\x10"); // Ctrl+P
|
|
65
|
+
|
|
66
|
+
expect((component as any).peekState.active).toBe(true);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it("returns to BTW without dismissing it when q exits Peek", () => {
|
|
70
|
+
let dismissed = 0;
|
|
71
|
+
const component = new BtwOverlayComponent(
|
|
72
|
+
tui,
|
|
73
|
+
theme,
|
|
74
|
+
keybindings,
|
|
75
|
+
() => [],
|
|
76
|
+
() => null,
|
|
77
|
+
() => "contextual",
|
|
78
|
+
() => {},
|
|
79
|
+
() => { dismissed++; },
|
|
80
|
+
() => {},
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
component.handleInput("\x10"); // Ctrl+P
|
|
84
|
+
component.handleInput("q");
|
|
85
|
+
|
|
86
|
+
expect((component as any).peekState.active).toBe(false);
|
|
87
|
+
expect(dismissed).toBe(0);
|
|
88
|
+
});
|
|
49
89
|
});
|
package/extensions/btw.ts
CHANGED
|
@@ -1335,8 +1335,8 @@ export class BtwOverlayComponent extends Container implements Focusable {
|
|
|
1335
1335
|
return;
|
|
1336
1336
|
}
|
|
1337
1337
|
|
|
1338
|
-
// Chat mode:
|
|
1339
|
-
if ((data
|
|
1338
|
+
// Chat mode: Ctrl+P enters Peek mode without consuming the draft.
|
|
1339
|
+
if (matchesKey(data, Key.ctrl("p"))) {
|
|
1340
1340
|
this.enterPeekMode();
|
|
1341
1341
|
return;
|
|
1342
1342
|
}
|
|
@@ -1929,12 +1929,9 @@ export class BtwOverlayComponent extends Container implements Focusable {
|
|
|
1929
1929
|
return;
|
|
1930
1930
|
}
|
|
1931
1931
|
|
|
1932
|
-
//
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
return;
|
|
1936
|
-
}
|
|
1937
|
-
if (data === "\r" || data === "\n" || data === "\x1b") {
|
|
1932
|
+
// Leaving Peek always returns to the BTW composer. The composer itself
|
|
1933
|
+
// remains responsible for dismissing the BTW overlay.
|
|
1934
|
+
if (data === "q" || data === "\x03" || data === "\r" || data === "\n" || data === "\x1b") {
|
|
1938
1935
|
this.exitPeekMode();
|
|
1939
1936
|
return;
|
|
1940
1937
|
}
|