Skip to content

Commit 98db462

Browse files
committed
fix(ui): 修复主题颜色和状态行显示问题
- 使用 useTheme 替代硬编码的颜色值以支持主题自适应 - 调整 Spinner 颜色为主题警告色 - 移除重复的状态行显示逻辑,避免冗余渲染 - 错误信息文本颜色改为主题危险色以增强提示效果 fix(tests): 修改消息元信息字段以符合实际含义 - 将消息元信息中的 isModelChange 替换为 settingChange 字段并赋值 "model" fix(ui): 修复提示输入组件粘贴标记高亮逻辑 - 为 highlightPasteMarkersInText 函数新增高亮颜色参数 - 调整调用 highlightPasteMarkersInText 时传入高亮色值 - 保持光标聚焦状态下文本渲染逻辑一致性
1 parent f940a7f commit 98db462

3 files changed

Lines changed: 6 additions & 10 deletions

File tree

src/tests/message-view.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ test("MessageView echoes model changes with submitted prompt wrapping", () => {
139139
const msg = makeSessionMessage({
140140
role: "system",
141141
content: "abcdefgh",
142-
meta: { isModelChange: true },
142+
meta: { settingChange: "model" },
143143
});
144144
const output = renderToString(React.createElement(MessageView, { message: msg, width: 8 }), { columns: 8 });
145145

src/ui/views/App.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ const StatusLine = React.memo(function StatusLine({
6464
busy: boolean;
6565
text?: string;
6666
}): React.ReactElement {
67+
const theme = useTheme();
6768
const [spinnerIndex, setSpinnerIndex] = useState(0);
6869

6970
useEffect(() => {
@@ -79,10 +80,10 @@ const StatusLine = React.memo(function StatusLine({
7980
}, [busy]);
8081

8182
return (
82-
<Box>
83+
<Box marginLeft={2}>
8384
{busy ? (
8485
<Box marginRight={1}>
85-
<Text color="yellow">{STATUS_SPINNER_FRAMES[spinnerIndex]}</Text>
86+
<Text color={theme.status.warning}>{STATUS_SPINNER_FRAMES[spinnerIndex]}</Text>
8687
</Box>
8788
) : null}
8889
{text ? <Text dimColor>{text}</Text> : null}
@@ -825,11 +826,6 @@ function App({ projectRoot, initialPrompt, onRestart }: AppProps): React.ReactEl
825826
}}
826827
</ThemeableStatic>
827828
{busy || statusLine ? <StatusLine busy={busy} text={statusLine} /> : null}
828-
{statusLine ? (
829-
<Box marginLeft={2}>
830-
<Text dimColor>{statusLine}</Text>
831-
</Box>
832-
) : null}
833829
{errorLine ? (
834830
<Box marginLeft={2}>
835831
<Text color={theme.status.danger}>Error: {errorLine}</Text>

src/ui/views/PromptInput.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -996,13 +996,13 @@ export function renderBufferWithCursor(
996996
}
997997

998998
if (!isFocused || !showSimulatedCursor) {
999-
return highlightPasteMarkersInText(text, validIds);
999+
return highlightPasteMarkersInText(text, validIds, h);
10001000
}
10011001

10021002
return renderFocusedText(text, cursor, validIds, h);
10031003
}
10041004

1005-
function highlightPasteMarkersInText(s: string, validIds: Map<number, string>): string {
1005+
function highlightPasteMarkersInText(s: string, validIds: Map<number, string>, highlightColor: string): string {
10061006
if (!s.includes("[paste #")) return s.endsWith("\n") ? `${s} ` : s;
10071007
PASTE_MARKER_REGEX.lastIndex = 0;
10081008
let result = "";

0 commit comments

Comments
 (0)