Skip to content

Commit e6d2149

Browse files
committed
show textarea placeholder only on home
1 parent b27f85b commit e6d2149

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
TextareaRenderable,
55
MouseEvent,
66
KeyEvent,
7-
SyntaxStyle,
87
PasteEvent,
98
t,
109
dim,
@@ -33,6 +32,7 @@ export type PromptProps = {
3332
onSubmit?: () => void
3433
ref?: (ref: PromptRef) => void
3534
hint?: JSX.Element
35+
showPlaceholder?: boolean
3636
}
3737

3838
export type PromptRef = {
@@ -382,7 +382,11 @@ export function Prompt(props: PromptProps) {
382382
</box>
383383
<box paddingTop={1} paddingBottom={1} backgroundColor={Theme.backgroundElement} flexGrow={1}>
384384
<textarea
385-
placeholder={t`${dim(fg(Theme.primary)(" → meta+↑↓"))} ${dim(fg("#64748b")("history"))} ${dim(fg("#a78bfa")("•"))} ${dim(fg(Theme.primary)("meta+return"))} ${dim(fg("#64748b")("newline"))} ${dim(fg("#a78bfa")("•"))} ${dim(fg(Theme.primary)("return"))} ${dim(fg("#64748b")("submit"))}`}
385+
placeholder={
386+
props.showPlaceholder
387+
? t`${dim(fg(Theme.primary)(" → meta+↑↓"))} ${dim(fg("#64748b")("history"))} ${dim(fg("#a78bfa")("•"))} ${dim(fg(Theme.primary)("meta+return"))} ${dim(fg("#64748b")("newline"))} ${dim(fg("#a78bfa")("•"))} ${dim(fg(Theme.primary)("return"))} ${dim(fg("#64748b")("submit"))}`
388+
: undefined
389+
}
386390
textColor={Theme.text}
387391
focusedTextColor={Theme.text}
388392
minHeight={1}

packages/opencode/src/cli/cmd/tui/routes/home.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export function Home() {
4242
<HelpRow keybind="agent_cycle">Switch agent</HelpRow>
4343
</box>
4444
<box width="100%" maxWidth={75} zIndex={1000} paddingTop={1}>
45-
<Prompt hint={Hint} />
45+
<Prompt hint={Hint} showPlaceholder={true} />
4646
</box>
4747
</box>
4848
)

0 commit comments

Comments
 (0)