pi-zh-cn 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/extensions/header.ts +13 -6
- package/package.json +1 -1
package/extensions/header.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
VERSION,
|
|
10
10
|
type ExtensionContext,
|
|
11
11
|
} from "@earendil-works/pi-coding-agent";
|
|
12
|
+
import { truncateToWidth } from "@earendil-works/pi-tui";
|
|
12
13
|
import { zh } from "./zh.ts";
|
|
13
14
|
|
|
14
15
|
/**
|
|
@@ -36,15 +37,21 @@ export function setChineseHeader(ctx: ExtensionContext) {
|
|
|
36
37
|
rawKeyHint("!", "bash"),
|
|
37
38
|
keyHint("app.tools.expand", zh.header.more),
|
|
38
39
|
].join(theme.fg("muted", " · "));
|
|
40
|
+
// 窄终端时按宽度截断,避免触发 pi 的超宽崩溃检查
|
|
41
|
+
const w = Math.max(1, _width);
|
|
39
42
|
return [
|
|
40
|
-
logo,
|
|
41
|
-
compact,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
truncateToWidth(logo, w, ""),
|
|
44
|
+
truncateToWidth(compact, w, ""),
|
|
45
|
+
truncateToWidth(
|
|
46
|
+
theme.fg(
|
|
47
|
+
"dim",
|
|
48
|
+
`${zh.header.expandHelp} (${keyText("app.tools.expand")})`,
|
|
49
|
+
),
|
|
50
|
+
w,
|
|
51
|
+
"",
|
|
45
52
|
),
|
|
46
53
|
"",
|
|
47
|
-
theme.fg("dim", zh.header.onboarding),
|
|
54
|
+
truncateToWidth(theme.fg("dim", zh.header.onboarding), w, ""),
|
|
48
55
|
];
|
|
49
56
|
},
|
|
50
57
|
invalidate() {},
|