mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-26 23:28:43 +00:00
refactor(tui): remove terminal pane setting
This commit is contained in:
parent
1e697962bd
commit
e9bb6d490b
8 changed files with 12 additions and 18 deletions
|
|
@ -51,15 +51,6 @@ export const settings: Setting[] = [
|
|||
values: ["hide", "auto"],
|
||||
keywords: ["side panel"],
|
||||
},
|
||||
{
|
||||
title: "Terminal",
|
||||
category: "Session",
|
||||
path: ["session", "terminal"],
|
||||
default: process.platform !== "win32",
|
||||
values: [false, true],
|
||||
labels: ["off", "on"],
|
||||
keywords: ["pty", "shell", "terminal pane"],
|
||||
},
|
||||
{
|
||||
title: "Scrollbar",
|
||||
category: "Session",
|
||||
|
|
|
|||
|
|
@ -148,7 +148,6 @@ export const Info = Schema.Struct({
|
|||
sidebar: Schema.optional(Schema.Literals(["auto", "hide"])).annotate({
|
||||
description: "Session sidebar visibility; 'auto' shows it when space permits",
|
||||
}),
|
||||
terminal: Schema.optional(Schema.Boolean).annotate({ description: "Enable persistent session terminal panes" }),
|
||||
scrollbar: Schema.optional(Schema.Boolean).annotate({ description: "Show the session transcript scrollbar" }),
|
||||
thinking: Schema.optional(Schema.Literals(["show", "hide"])).annotate({
|
||||
description: "Show or hide model reasoning by default",
|
||||
|
|
@ -260,6 +259,7 @@ export type Resolved = Omit<Info, "attention" | "cursor" | "keybinds" | "leader"
|
|||
session: Omit<NonNullable<Info["session"]>, "new_location" | "permissions" | "tps"> & {
|
||||
new_location: "launch" | "inherit"
|
||||
permissions: "prompt" | "autoaccept"
|
||||
terminal: boolean
|
||||
tps: boolean
|
||||
}
|
||||
tabs: {
|
||||
|
|
@ -308,7 +308,7 @@ export function resolve(input: Info, options: { terminalSuspend: boolean }): Res
|
|||
new_location: input.session?.new_location ?? "launch",
|
||||
permissions: input.session?.permissions ?? "prompt",
|
||||
// Persistent terminal panes need the opencode-pty daemon, which does not ship Windows binaries.
|
||||
terminal: input.session?.terminal ?? process.platform !== "win32",
|
||||
terminal: process.platform !== "win32",
|
||||
tps: input.session?.tps ?? true,
|
||||
},
|
||||
tabs: {
|
||||
|
|
|
|||
|
|
@ -1328,7 +1328,6 @@ test.each(["manual", "select"] as const)(
|
|||
get: async () => ({
|
||||
animations: false,
|
||||
terminal: { copy },
|
||||
session: { terminal: true },
|
||||
}),
|
||||
update: async () => ({}),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ async function renderComposer(
|
|||
const app = await testRender(
|
||||
() => (
|
||||
<TestTuiContexts directory={directory}>
|
||||
<ConfigProvider config={createTuiResolvedConfig({ keybinds, session: { terminal: false } })}>
|
||||
<ConfigProvider config={createTuiResolvedConfig({ keybinds }, { terminal: false })}>
|
||||
<Keymap.Provider>
|
||||
<ClientProvider api={createApi(calls.fetch)}>
|
||||
<DataProvider directory={process.cwd()}>
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ function emitEvent(events: ReturnType<typeof createEventStream>, event: OpenCode
|
|||
events.emit({ ...event, location: { directory } })
|
||||
}
|
||||
|
||||
const config = createTuiResolvedConfig({ session: { terminal: false } })
|
||||
const config = createTuiResolvedConfig({}, { terminal: false })
|
||||
|
||||
function DataProvider(props: ParentProps) {
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ async function setup(width: number, output = "") {
|
|||
const app = await testRender(
|
||||
() => (
|
||||
<TestTuiContexts directory={temporary.path} paths={{ state: temporary.path }}>
|
||||
<ConfigProvider config={createTuiResolvedConfig({ session: { terminal: false } })}>
|
||||
<ConfigProvider config={createTuiResolvedConfig({}, { terminal: false })}>
|
||||
<RouteProvider initialRoute={{ type: "session", sessionID: "ses_fixture" }}>
|
||||
<ClientProvider api={api}>
|
||||
<DataProvider directory={temporary.path}>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,10 @@ type ResolvedInput = Omit<Info, "attention" | "keybinds" | "leader"> & {
|
|||
leader?: { timeout?: number }
|
||||
}
|
||||
|
||||
export function createTuiResolvedConfig(input: ResolvedInput = {}) {
|
||||
return resolve(input, { terminalSuspend: process.platform !== "win32" })
|
||||
export function createTuiResolvedConfig(input: ResolvedInput = {}, options?: { terminal?: boolean }) {
|
||||
const config = resolve(input, { terminalSuspend: process.platform !== "win32" })
|
||||
return {
|
||||
...config,
|
||||
session: { ...config.session, terminal: options?.terminal ?? config.session.terminal },
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ test.each([80, 120, 180])("session wheel scrolling preserves pane focus at width
|
|||
app: { name: "test", version: "test", channel: "test" },
|
||||
server: { endpoint: { url: server.url.toString() } },
|
||||
config: {
|
||||
get: async () => ({ animations: false, session: { terminal: true }, tabs: { enabled: false } }),
|
||||
get: async () => ({ animations: false, tabs: { enabled: false } }),
|
||||
update: async () => ({}),
|
||||
},
|
||||
packages: { prepare: async () => ({ directory: "" }) },
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue