Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions packages/opencode/src/cli/cmd/tui/routes/session/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ const context = createContext<{
showTimestamps: () => boolean
showDetails: () => boolean
showGenericToolOutput: () => boolean
bashFollowCollapsed: () => boolean
diffWrapMode: () => "word" | "none"
providers: () => ReadonlyMap<string, Provider>
sync: ReturnType<typeof useSync>
Expand Down Expand Up @@ -153,6 +154,7 @@ export function Session() {
const [diffWrapMode] = kv.signal<"word" | "none">("diff_wrap_mode", "word")
const [animationsEnabled, setAnimationsEnabled] = kv.signal("animations_enabled", true)
const [showGenericToolOutput, setShowGenericToolOutput] = kv.signal("generic_tool_output_visibility", false)
const [bashFollowCollapsed, setBashFollowCollapsed] = kv.signal("bash_follow_collapsed", false)

const wide = createMemo(() => dimensions().width > 120)
const sidebarVisible = createMemo(() => {
Expand Down Expand Up @@ -637,6 +639,16 @@ export function Session() {
dialog.clear()
},
},
{
title: "Toggle collapsed bash follow",
value: "session.toggle.bash_follow_collapsed",
keybind: "bash_follow_collapsed",
category: "Session",
onSelect: (dialog) => {
setBashFollowCollapsed((prev) => !prev)
dialog.clear()
},
},
{
title: "Page up",
value: "session.page.up",
Expand Down Expand Up @@ -1025,6 +1037,7 @@ export function Session() {
showTimestamps,
showDetails,
showGenericToolOutput,
bashFollowCollapsed,
diffWrapMode,
providers,
sync,
Expand Down Expand Up @@ -1759,6 +1772,7 @@ function BlockTool(props: {

function Bash(props: ToolProps<typeof BashTool>) {
const { theme } = useTheme()
const ctx = use()
const sync = useSync()
const isRunning = createMemo(() => props.part.state.status === "running")
const output = createMemo(() => stripAnsi(props.metadata.output?.trim() ?? ""))
Expand All @@ -1767,6 +1781,7 @@ function Bash(props: ToolProps<typeof BashTool>) {
const overflow = createMemo(() => lines().length > 10)
const limited = createMemo(() => {
if (expanded() || !overflow()) return output()
if (ctx.bashFollowCollapsed()) return ["…", ...lines().slice(-10)].join("\n")
return [...lines().slice(0, 10), "…"].join("\n")
})

Expand Down
5 changes: 5 additions & 0 deletions packages/opencode/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,11 @@ export namespace Config {
.default("<leader>h")
.describe("Toggle code block concealment in messages"),
tool_details: z.string().optional().default("none").describe("Toggle tool details visibility"),
bash_follow_collapsed: z
.string()
.optional()
.default("none")
.describe("Toggle bash output following in collapsed view"),
model_list: z.string().optional().default("<leader>m").describe("List available models"),
model_cycle_recent: z.string().optional().default("f2").describe("Next recently used model"),
model_cycle_recent_reverse: z.string().optional().default("shift+f2").describe("Previous recently used model"),
Expand Down
Loading