Skip to content

Commit c7bc1ba

Browse files
authored
docs(help): update in-app controls help (#175)
1 parent 8c20d41 commit c7bc1ba

4 files changed

Lines changed: 24 additions & 12 deletions

File tree

src/ui/AppHost.interactions.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,15 +1601,15 @@ describe("App interactions", () => {
16011601

16021602
let frame = setup.captureCharFrame();
16031603
expect(frame).toContain("Toggle files/filter focus");
1604-
expect(frame).not.toContain("Keyboard help");
1604+
expect(frame).not.toContain("Controls help");
16051605

16061606
await act(async () => {
16071607
await setup.mockInput.pressArrow("left");
16081608
});
16091609
await flush(setup);
16101610

16111611
frame = setup.captureCharFrame();
1612-
expect(frame).toContain("Keyboard help");
1612+
expect(frame).toContain("Controls help");
16131613
expect(frame).not.toContain("Toggle files/filter focus");
16141614

16151615
await act(async () => {
@@ -1619,7 +1619,7 @@ describe("App interactions", () => {
16191619

16201620
frame = setup.captureCharFrame();
16211621
expect(frame).toContain("Toggle files/filter focus");
1622-
expect(frame).not.toContain("Keyboard help");
1622+
expect(frame).not.toContain("Controls help");
16231623
} finally {
16241624
await act(async () => {
16251625
setup.renderer.destroy();

src/ui/components/chrome/HelpDialog.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { fitText, padText } from "../../lib/text";
22
import type { AppTheme } from "../../themes";
33
import { ModalFrame } from "./ModalFrame";
44

5-
/** Render the keyboard help modal. */
5+
/** Render the in-app controls help modal. */
66
export function HelpDialog({
77
canRefresh = false,
88
terminalHeight,
@@ -27,10 +27,17 @@ export function HelpDialog({
2727
["d / u", "half page down / up"],
2828
["[ / ]", "previous / next hunk"],
2929
["{ / }", "previous / next comment"],
30-
["← / →", "scroll code (Shift = faster)"],
30+
["← / →", "scroll code left / right (Shift = faster)"],
3131
["Home / End", "jump to top / bottom"],
3232
],
3333
},
34+
{
35+
title: "Mouse",
36+
items: [
37+
["Wheel", "scroll vertically"],
38+
["Shift+Wheel", "scroll code horizontally"],
39+
],
40+
},
3441
{
3542
title: "View",
3643
items: [
@@ -92,7 +99,7 @@ export function HelpDialog({
9299
terminalHeight={terminalHeight}
93100
terminalWidth={terminalWidth}
94101
theme={theme}
95-
title="Keyboard help"
102+
title="Controls help"
96103
width={width}
97104
onClose={onClose}
98105
>

src/ui/components/ui-components.test.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,22 +1292,22 @@ describe("UI components", () => {
12921292
expect(frame).not.toContain("Update available:");
12931293
});
12941294

1295-
test("HelpDialog renders every keyboard shortcut row without overlap", async () => {
1295+
test("HelpDialog renders every documented control row without overlap", async () => {
12961296
const theme = resolveTheme("midnight", null);
12971297
const frame = await captureFrame(
12981298
<HelpDialog
12991299
canRefresh={true}
1300-
terminalHeight={31}
1300+
terminalHeight={36}
13011301
terminalWidth={76}
13021302
theme={theme}
13031303
onClose={() => {}}
13041304
/>,
13051305
76,
1306-
31,
1306+
36,
13071307
);
13081308

13091309
const expectedRows = [
1310-
"Keyboard help",
1310+
"Controls help",
13111311
"[Esc]",
13121312
"Navigation",
13131313
"↑ / ↓ move line-by-line",
@@ -1317,8 +1317,11 @@ describe("UI components", () => {
13171317
"d / u half page down / up",
13181318
"[ / ] previous / next hunk",
13191319
"{ / } previous / next comment",
1320-
"← / → scroll code (Shift = faster)",
1320+
"← / → scroll code left / right (Shift = faster)",
13211321
"Home / End jump to top / bottom",
1322+
"Mouse",
1323+
"Wheel scroll vertically",
1324+
"Shift+Wheel scroll code horizontally",
13221325
"View",
13231326
"1 / 2 / 0 split / stack / auto",
13241327
"s / t sidebar / theme",
@@ -1337,9 +1340,11 @@ describe("UI components", () => {
13371340

13381341
const lines = frame.split("\n");
13391342
const blankModalRow = /\s+/;
1343+
const mouseHeaderIndex = lines.findIndex((line) => line.includes("│ Mouse"));
13401344
const viewHeaderIndex = lines.findIndex((line) => line.includes("│ View"));
13411345
const reviewHeaderIndex = lines.findIndex((line) => line.includes("│ Review"));
13421346

1347+
expect(lines[mouseHeaderIndex - 1]).toMatch(blankModalRow);
13431348
expect(lines[viewHeaderIndex - 1]).toMatch(blankModalRow);
13441349
expect(lines[reviewHeaderIndex - 1]).toMatch(blankModalRow);
13451350
expect(frame).not.toContain("linese/Awrapt/smetadata");

src/ui/lib/appMenus.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ export function buildAppMenus({
216216
help: [
217217
{
218218
kind: "item",
219-
label: "Keyboard help",
219+
label: "Controls help",
220220
hint: "?",
221221
checked: showHelp,
222222
action: toggleHelp,

0 commit comments

Comments
 (0)