From b85b0d31905dd4f731a717d528f742bc01eaca21 Mon Sep 17 00:00:00 2001 From: 01luyicheng Date: Sat, 31 Jan 2026 20:56:40 +0800 Subject: [PATCH 01/10] fix(pty): Add UTF-8 encoding defaults for Windows PTY Set LC_ALL, LC_CTYPE, and LANG environment variables to C.UTF-8 on Windows platform to fix Chinese character display issues in terminal. Related issues: - #9793: Chinese characters displayed as garbled text in CLI mode - #9790: Process killed with garbled output when dragging terminal window - #9787: Occasional process killed with garbled output - #8410: TUI icons show as garbage characters on Windows 10 - #7891: OpenCode TUI Chinese Text Display Issue Related PR: #10489 --- packages/opencode/src/pty/index.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/opencode/src/pty/index.ts b/packages/opencode/src/pty/index.ts index 73474ed4f8..d01b2b02e9 100644 --- a/packages/opencode/src/pty/index.ts +++ b/packages/opencode/src/pty/index.ts @@ -108,6 +108,12 @@ export namespace Pty { TERM: "xterm-256color", OPENCODE_TERMINAL: "1", } as Record + + if (process.platform === "win32") { + env.LC_ALL = "C.UTF-8" + env.LC_CTYPE = "C.UTF-8" + env.LANG = "C.UTF-8" + } log.info("creating session", { id, cmd: command, args, cwd }) const spawn = await pty() From d43a1f5eece4f985669cb0cfa6557c598b0ba301 Mon Sep 17 00:00:00 2001 From: 01luyicheng Date: Sun, 1 Feb 2026 09:49:21 +0800 Subject: [PATCH 02/10] fix(tui): Fix tip text truncation in TUI (issue #11154) --- packages/opencode/src/cli/cmd/tui/component/tips.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/opencode/src/cli/cmd/tui/component/tips.tsx b/packages/opencode/src/cli/cmd/tui/component/tips.tsx index 3f0318e269..141fddaad8 100644 --- a/packages/opencode/src/cli/cmd/tui/component/tips.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/tips.tsx @@ -39,9 +39,9 @@ export function Tips() { ● Tip{" "} - + - {(part) => {part.text}} + {(part) => {part.text}} From 5cbe764fa7354670bdbe2dfb9a90e91abc13f0d5 Mon Sep 17 00:00:00 2001 From: 01luyicheng Date: Sun, 1 Feb 2026 10:37:58 +0800 Subject: [PATCH 03/10] fix(tui): Fix TypeScript error in tips.tsx --- packages/opencode/src/cli/cmd/tui/component/tips.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/opencode/src/cli/cmd/tui/component/tips.tsx b/packages/opencode/src/cli/cmd/tui/component/tips.tsx index 141fddaad8..a7cce58e16 100644 --- a/packages/opencode/src/cli/cmd/tui/component/tips.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/tips.tsx @@ -1,5 +1,6 @@ import { createMemo, createSignal, For } from "solid-js" import { DEFAULT_THEMES, useTheme } from "@tui/context/theme" +import { Locale } from "@/util/locale" const themeCount = Object.keys(DEFAULT_THEMES).length const themeTip = `Use {highlight}/theme{/highlight} or {highlight}Ctrl+X T{/highlight} to switch between ${themeCount} built-in themes` @@ -39,9 +40,9 @@ export function Tips() { ● Tip{" "} - + - {(part) => {part.text}} + {(part) => {part.text}} From a87b7fdeccd514fd3f8e491b007ff4cea1998ada Mon Sep 17 00:00:00 2001 From: 01luyicheng Date: Sun, 1 Feb 2026 11:04:59 +0800 Subject: [PATCH 04/10] fix(tui): Use wrapMode=word instead of none for tips text --- packages/opencode/src/cli/cmd/tui/component/tips.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/opencode/src/cli/cmd/tui/component/tips.tsx b/packages/opencode/src/cli/cmd/tui/component/tips.tsx index ee14249a29..110a5e1af8 100644 --- a/packages/opencode/src/cli/cmd/tui/component/tips.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/tips.tsx @@ -40,7 +40,7 @@ export function Tips() { ● Tip{" "} - + {(part) => {part.text}} From c9fe73dacccebb8f77b0942b4ae20126849ab689 Mon Sep 17 00:00:00 2001 From: 01luyicheng Date: Sun, 1 Feb 2026 11:13:50 +0800 Subject: [PATCH 05/10] fix(tui): Remove fixed height from Tips container to allow text wrapping --- packages/opencode/src/cli/cmd/tui/routes/home.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/opencode/src/cli/cmd/tui/routes/home.tsx b/packages/opencode/src/cli/cmd/tui/routes/home.tsx index 59923c69d9..da3400a141 100644 --- a/packages/opencode/src/cli/cmd/tui/routes/home.tsx +++ b/packages/opencode/src/cli/cmd/tui/routes/home.tsx @@ -105,7 +105,7 @@ export function Home() { hint={Hint} /> - + From 8aca8e77e2bb9017b32045bd457fa6fc54e21060 Mon Sep 17 00:00:00 2001 From: 01luyicheng Date: Sun, 1 Feb 2026 11:17:02 +0800 Subject: [PATCH 06/10] fix(tui): Add width=100% to tips text and remove container constraints --- packages/opencode/src/cli/cmd/tui/component/tips.tsx | 2 +- packages/opencode/src/cli/cmd/tui/routes/home.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/opencode/src/cli/cmd/tui/component/tips.tsx b/packages/opencode/src/cli/cmd/tui/component/tips.tsx index 110a5e1af8..4bfb42dce6 100644 --- a/packages/opencode/src/cli/cmd/tui/component/tips.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/tips.tsx @@ -40,7 +40,7 @@ export function Tips() { ● Tip{" "} - + {(part) => {part.text}} diff --git a/packages/opencode/src/cli/cmd/tui/routes/home.tsx b/packages/opencode/src/cli/cmd/tui/routes/home.tsx index da3400a141..9c881e3e5b 100644 --- a/packages/opencode/src/cli/cmd/tui/routes/home.tsx +++ b/packages/opencode/src/cli/cmd/tui/routes/home.tsx @@ -105,7 +105,7 @@ export function Home() { hint={Hint} /> - + From 9712a60dfb8dfb86423745551b3ac4b4a46bb439 Mon Sep 17 00:00:00 2001 From: 01luyicheng Date: Sun, 1 Feb 2026 11:20:24 +0800 Subject: [PATCH 07/10] fix(tui): Change flexDirection to column for tips layout --- packages/opencode/src/cli/cmd/tui/component/tips.tsx | 2 +- packages/opencode/src/cli/cmd/tui/routes/home.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/opencode/src/cli/cmd/tui/component/tips.tsx b/packages/opencode/src/cli/cmd/tui/component/tips.tsx index 4bfb42dce6..f029b9d27f 100644 --- a/packages/opencode/src/cli/cmd/tui/component/tips.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/tips.tsx @@ -36,7 +36,7 @@ export function Tips() { const parts = parse(TIPS[Math.floor(Math.random() * TIPS.length)]) return ( - + ● Tip{" "} diff --git a/packages/opencode/src/cli/cmd/tui/routes/home.tsx b/packages/opencode/src/cli/cmd/tui/routes/home.tsx index 9c881e3e5b..6a72b9223b 100644 --- a/packages/opencode/src/cli/cmd/tui/routes/home.tsx +++ b/packages/opencode/src/cli/cmd/tui/routes/home.tsx @@ -105,7 +105,7 @@ export function Home() { hint={Hint} /> - + From 74bc4988a5205b001ca12187afaab284aee93d69 Mon Sep 17 00:00:00 2001 From: 01luyicheng Date: Sun, 1 Feb 2026 11:25:15 +0800 Subject: [PATCH 08/10] fix(tui): Use flexGrow instead of flexShrink for tips text --- packages/opencode/src/cli/cmd/tui/component/tips.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/opencode/src/cli/cmd/tui/component/tips.tsx b/packages/opencode/src/cli/cmd/tui/component/tips.tsx index f029b9d27f..3da26d3e4e 100644 --- a/packages/opencode/src/cli/cmd/tui/component/tips.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/tips.tsx @@ -36,11 +36,11 @@ export function Tips() { const parts = parse(TIPS[Math.floor(Math.random() * TIPS.length)]) return ( - + ● Tip{" "} - + {(part) => {part.text}} From 365ce0ce8c6a15ab76173077639adc82a8ad437e Mon Sep 17 00:00:00 2001 From: 01luyicheng Date: Sun, 1 Feb 2026 11:41:59 +0800 Subject: [PATCH 09/10] fix(tui): Add useTerminalDimensions to Tips and fix container layout --- packages/opencode/src/cli/cmd/tui/component/tips.tsx | 4 +++- packages/opencode/src/cli/cmd/tui/routes/home.tsx | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/opencode/src/cli/cmd/tui/component/tips.tsx b/packages/opencode/src/cli/cmd/tui/component/tips.tsx index 3da26d3e4e..b475a98b34 100644 --- a/packages/opencode/src/cli/cmd/tui/component/tips.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/tips.tsx @@ -1,4 +1,5 @@ import { createMemo, createSignal, For } from "solid-js" +import { useTerminalDimensions } from "@opentui/solid" import { DEFAULT_THEMES, useTheme } from "@tui/context/theme" import { Locale } from "@/util/locale" @@ -33,10 +34,11 @@ function parse(tip: string): TipPart[] { export function Tips() { const theme = useTheme().theme + const dimensions = useTerminalDimensions() const parts = parse(TIPS[Math.floor(Math.random() * TIPS.length)]) return ( - + ● Tip{" "} diff --git a/packages/opencode/src/cli/cmd/tui/routes/home.tsx b/packages/opencode/src/cli/cmd/tui/routes/home.tsx index 6a72b9223b..b1766add0a 100644 --- a/packages/opencode/src/cli/cmd/tui/routes/home.tsx +++ b/packages/opencode/src/cli/cmd/tui/routes/home.tsx @@ -93,7 +93,7 @@ export function Home() { return ( <> - + @@ -105,7 +105,7 @@ export function Home() { hint={Hint} /> - + From edc582e8a00227a0901bfc4e097b736868beed1d Mon Sep 17 00:00:00 2001 From: 01luyicheng Date: Sun, 1 Feb 2026 13:11:50 +0800 Subject: [PATCH 10/10] fix(tui): Simplify Tips layout and remove container constraints --- packages/opencode/src/cli/cmd/tui/component/tips.tsx | 4 +--- packages/opencode/src/cli/cmd/tui/routes/home.tsx | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/opencode/src/cli/cmd/tui/component/tips.tsx b/packages/opencode/src/cli/cmd/tui/component/tips.tsx index b475a98b34..16b454eaad 100644 --- a/packages/opencode/src/cli/cmd/tui/component/tips.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/tips.tsx @@ -1,5 +1,4 @@ import { createMemo, createSignal, For } from "solid-js" -import { useTerminalDimensions } from "@opentui/solid" import { DEFAULT_THEMES, useTheme } from "@tui/context/theme" import { Locale } from "@/util/locale" @@ -34,11 +33,10 @@ function parse(tip: string): TipPart[] { export function Tips() { const theme = useTheme().theme - const dimensions = useTerminalDimensions() const parts = parse(TIPS[Math.floor(Math.random() * TIPS.length)]) return ( - + ● Tip{" "} diff --git a/packages/opencode/src/cli/cmd/tui/routes/home.tsx b/packages/opencode/src/cli/cmd/tui/routes/home.tsx index b1766add0a..0fbfca8506 100644 --- a/packages/opencode/src/cli/cmd/tui/routes/home.tsx +++ b/packages/opencode/src/cli/cmd/tui/routes/home.tsx @@ -105,7 +105,7 @@ export function Home() { hint={Hint} /> - +