Skip to content

feat(tui): 优化 Markdown 渲染与折叠性能,并新增 /web 启动入口#600

Merged
phantom5099 merged 5 commits into1024XEngineer:mainfrom
creatang:main
May 10, 2026
Merged

feat(tui): 优化 Markdown 渲染与折叠性能,并新增 /web 启动入口#600
phantom5099 merged 5 commits into1024XEngineer:mainfrom
creatang:main

Conversation

@creatang
Copy link
Copy Markdown
Collaborator

@creatang creatang commented May 9, 2026

Summary

本 PR 聚焦 TUI 体验优化与 Web 入口补齐,主要包括:

  • 调整 Markdown 渲染样式(去背景、高亮色调整、表格/分隔线/中英混排对齐改进)
  • 优化折叠展开后的渲染与分页计算链路,减少卡顿、残影与延迟
  • 新增 /web 指令启动 Web 端入口
  • 补充相关测试与 Windows 终端字体脚本

Changes

  • Markdown/TUI 渲染:
    • 去除不必要背景渲染
    • 强调/高亮配色调整(红色 -> 黄色)
    • 表格与分隔线渲染修复
    • 中英混排下 padding、对齐、间距策略优化
  • 折叠展开性能:
    • 调整页面重算触发策略,避免全量影响
    • 修复局部残留与翻页异常延迟问题
  • Slash Command:
    • 支持 /web 在 TUI 内触发 Web UI 启动链路
  • 工程化:
    • 增加/更新对应单元测试
    • 增加 Windows 字体设置脚本(JetBrains Mono)

Validation

  • go test ./internal/tui/core/app
  • go test ./internal/tui/infra/...
  • 手动验证:
    • 折叠/展开后翻页无明显卡顿与残影
    • 表格、---、中英混排显示对齐正常
    • /web 可触发 Web UI 启动

Risk

  • 渲染样式与缓存策略变更覆盖面较广,可能影响少量边界 markdown 场景
  • 建议重点回归:长文本、复杂表格、连续折叠展开、窗口 resize 场景

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

Copy link
Copy Markdown

@fennoai fennoai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the PR in four passes (code quality, performance, security, documentation). I found 3 noteworthy issues; no separate security-specific findings beyond the items below.

}

args := []string{"web", "--open-browser=true"}
if strings.TrimSpace(workdir) != "" {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/web respawns the current executable but never sets command.Dir or passes any static-asset/source location to the child. That breaks a common source-build workflow: if the TUI was started via go run ./cmd/neocode from some workspace, the child inherits that workspace cwd, while neocode web only probes ./web/... and executable-adjacent paths. With a go run temp binary, both lookups miss, so /web fails even though the command is advertised as available. Please anchor the child to the repo/binary asset root or pass --static-dir explicitly.

$settingsPath = $settingsCandidates | Where-Object { Test-Path $_ } | Select-Object -First 1
if ([string]::IsNullOrWhiteSpace($settingsPath)) {
throw "Windows Terminal settings.json was not found."
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This rewrites Windows Terminal's settings.json via ConvertFrom-Json/ConvertTo-Json, but that file is typically JSONC. In Windows PowerShell 5.1, commented/trailing-comma settings files will fail to parse; even when parsing succeeds, writing it back strips comments and formatting from the user's terminal config. As written, the helper can either fail on stock configs or unexpectedly rewrite them. It needs a JSONC-safe edit path, or at least an explicit PowerShell-version/format guard.

{Usage: slashUsageModel, Description: "Open the interactive model picker"},
{Usage: slashUsageSession, Description: "Switch to another session"},
{Usage: slashUsageWeb, Description: "Start Web UI in browser"},
{Usage: slashUsageExit, Description: "Exit NeoCode"},
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/web is now a user-facing slash command, but the slash-command docs were not updated alongside this addition. The current guides (www/guide/slash-commands.md, www/en/guide/slash-commands.md, and README command listings) still describe the old command set, so this change introduces immediate doc drift.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 9, 2026

@phantom5099 phantom5099 merged commit 61ba7bc into 1024XEngineer:main May 10, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants