mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-18 07:12:47 +03:00
fix(tui): show remaining dialog hints label-first (#55745)
This commit is contained in:
committed by
GitHub
Unverified
parent
838d41a0a0
commit
18d1dd453a
@@ -5,7 +5,7 @@ import { useConfig } from "../config"
|
||||
import { Keymap } from "../context/keymap"
|
||||
import type { TuiHighlight } from "../context/runtime"
|
||||
import { useTheme } from "../context/theme"
|
||||
import { DIALOG_INSET, DialogBleed, DialogHeader, DialogLayout, useDialog } from "../ui/dialog"
|
||||
import { DIALOG_INSET, DialogBleed, DialogFooter, DialogHeader, DialogLayout, useDialog } from "../ui/dialog"
|
||||
import { getScrollAcceleration } from "../util/scroll"
|
||||
|
||||
export function DialogHighlights(props: { version: string; items: ReadonlyArray<TuiHighlight> }) {
|
||||
@@ -37,7 +37,7 @@ export function DialogHighlights(props: { version: string; items: ReadonlyArray<
|
||||
header={<DialogHeader title={`What's new in ${props.version}`} />}
|
||||
footer={
|
||||
<box flexDirection="row" justifyContent="space-between" alignItems="center">
|
||||
<text fg={theme.text.muted}>↑/↓ scroll</text>
|
||||
<DialogFooter actions={[{ title: "scroll", key: "↑/↓" }]} />
|
||||
<box
|
||||
paddingLeft={3}
|
||||
paddingRight={3}
|
||||
|
||||
@@ -152,11 +152,7 @@ export function DialogMcp(props: { initialServer?: string; details?: boolean } =
|
||||
},
|
||||
},
|
||||
]}
|
||||
footer={
|
||||
<Show when={focusedError()}>
|
||||
<text fg={theme.text.muted}>enter to view error</text>
|
||||
</Show>
|
||||
}
|
||||
footerHints={focusedError() ? [{ title: "view error", label: "enter" }] : []}
|
||||
/>
|
||||
}
|
||||
>
|
||||
|
||||
@@ -6,7 +6,7 @@ import stripAnsi from "strip-ansi"
|
||||
import { useClient } from "../context/client"
|
||||
import { Keymap } from "../context/keymap"
|
||||
import { useTheme } from "../context/theme"
|
||||
import { DialogHeader, DialogLayout, useDialog } from "../ui/dialog"
|
||||
import { DialogFooter, DialogHeader, DialogLayout, useDialog } from "../ui/dialog"
|
||||
|
||||
const PAGE_BYTES = 64 * 1024
|
||||
|
||||
@@ -114,11 +114,13 @@ export function DialogShellOutput(props: { shell: ShellInfo; location: LocationR
|
||||
</DialogHeader>
|
||||
}
|
||||
footer={
|
||||
<box flexDirection="row" gap={2} flexWrap="wrap">
|
||||
<text fg={theme.text.muted}>↑/↓ scroll</text>
|
||||
<text fg={theme.text.muted}>end follow</text>
|
||||
<text fg={theme.text.muted}>esc back</text>
|
||||
</box>
|
||||
<DialogFooter
|
||||
actions={[
|
||||
{ title: "scroll", key: "↑/↓" },
|
||||
{ title: "follow", key: "end" },
|
||||
{ title: "back", key: "esc" },
|
||||
]}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<box gap={1}>
|
||||
|
||||
@@ -22,7 +22,7 @@ test.each(["enter", "space"])("starts OAuth with %s for an MCP server requiring
|
||||
|
||||
try {
|
||||
await fixture.app.waitForFrame((frame) => frame.includes("Sign in required"))
|
||||
expect(fixture.app.captureCharFrame()).not.toContain("enter to view error")
|
||||
expect(fixture.app.captureCharFrame()).not.toContain("view error")
|
||||
if (key === "enter") fixture.app.mockInput.pressEnter()
|
||||
else fixture.app.mockInput.pressKey(" ")
|
||||
await fixture.app.waitForFrame((frame) => frame.includes("Waiting for authorization"))
|
||||
@@ -40,6 +40,7 @@ test("opens an investigation draft for a failed MCP server at its originating lo
|
||||
|
||||
try {
|
||||
await fixture.app.waitForFrame((frame) => frame.includes("Failed !"))
|
||||
expect(fixture.app.captureCharFrame()).toContain("view error enter")
|
||||
fixture.app.mockInput.pressEnter()
|
||||
await fixture.app.waitForFrame((frame) => frame.includes("investigate i"))
|
||||
fixture.app.mockInput.pressKey("i")
|
||||
|
||||
@@ -50,7 +50,7 @@ test("scrolls long highlights between a fixed title and footer", async () => {
|
||||
await app.waitForFrame((frame) => frame.includes("What's new in 2.0.27") && frame.includes("Highlight 1"))
|
||||
const top = app.captureCharFrame()
|
||||
expect(top).toContain("command-1")
|
||||
expect(top).toContain("↑/↓ scroll")
|
||||
expect(top).toContain("scroll ↑/↓")
|
||||
expect(top).not.toContain("Highlight 5")
|
||||
expect(top).not.toContain("`")
|
||||
|
||||
@@ -58,7 +58,7 @@ test("scrolls long highlights between a fixed title and footer", async () => {
|
||||
await app.waitForFrame((frame) => frame.includes("Highlight 5"))
|
||||
const bottom = app.captureCharFrame()
|
||||
expect(bottom).toContain("What's new in 2.0.27")
|
||||
expect(bottom).toContain("↑/↓ scroll")
|
||||
expect(bottom).toContain("scroll ↑/↓")
|
||||
expect(bottom).not.toContain("Highlight 1")
|
||||
|
||||
app.mockInput.pressKey("k")
|
||||
|
||||
Reference in New Issue
Block a user