Skip to content

feat: complete GUI overhaul with Nerd Font fix, syntax highlighting, chat redesign, tool approval, and i18n#766

Open
jwandbj wants to merge 9 commits intoHmbown:mainfrom
jwandbj:feature/my-change
Open

feat: complete GUI overhaul with Nerd Font fix, syntax highlighting, chat redesign, tool approval, and i18n#766
jwandbj wants to merge 9 commits intoHmbown:mainfrom
jwandbj:feature/my-change

Conversation

@jwandbj
Copy link
Copy Markdown

@jwandbj jwandbj commented May 6, 2026

Summary

This PR delivers a significant GUI overhaul, fixing multiple visual and functional issues while adding new features to improve user experience. All changes are contained within crates/gui and crates/tui (prompts), and are fully backward-compatible with the existing TUI.

🎨 UI & Interaction

  • Nerd Font icon fix: Registered JetBrains Mono Nerd Font in the Proportional font family as a fallback, resolving the "tofu" (box) display for icons like in the file tree.
  • File tree color coding: Added file_type_color() to color files by extension (e.g., .rs orange, .md blue, .json/.yaml yellow).
  • Syntax highlighting: Integrated syntect with base16-ocean.dark theme. Added highlight_code() and plain_text_layout_job() (fallback for large files) for the editor.
  • Tab performance: Introduced a highlight cache to avoid recomputation; enforced MAX_TABS = 12 with automatic closing of the oldest unmodified tab; skip highlighting for files >20k chars.
  • Tab context menu: Added "Close Others" and "Close All" using deferred execution to prevent egui borrow conflicts.
  • Auto-save after editing: Mark dirty on content change and save after UI rendering.
  • Chat panel redesign: Redesigned chat panel with a title bar (model name + status indicator), rounded border frame around input, arrow send button (), and button gray-out during streaming.

🛡️ Tool Approval

  • Initial modal dialog (Qoder-inspired style): semi-transparent overlay, yellow border, large tool name, code block for command, green Approve / red Deny buttons.
  • Final inline card design: Replaced modal with an inline card directly in the chat message stream. Card includes ⚠ icon, tool name, command preview, and ▶ Run / ✗ Cancel buttons. Asynchronous approve_tool_call/deny_tool_call.

⚠️ Error Handling

  • Friendly Chinese error messages: New friendly_error_message() translates common API errors:
    • 402 → "API 余额不足..."
    • 401 → "API Key 无效..."
    • 429 → "请求过于频繁..."
    • Timeout / Connection → corresponding Chinese messages.
  • Improved SystemError bubble: Full-width, larger rounded corners, ⚠ icon with friendly Chinese text.

🌐 Language

  • Force Chinese reply: Added a Language instruction in the system prompt (before volatile-content boundary) to ensure the model always responds in Chinese, including thinking process. Cache-stable for prefix cache hits.

📁 Files Changed

  • crates/gui/Cargo.toml – added syntect dependency
  • crates/gui/src/theme.rs – Nerd Font Proportional fallback
  • crates/gui/src/app.rs – all UI/interaction features, caching, chat, approval, error handling
  • crates/tui/src/prompts.rs – Chinese locale system prompt

Testing

  • cargo test --all-features
  • cargo fmt --all --check
  • cargo clippy --all-targets --all-features
  • Manually verified TUI behavior remains unchanged (prompts only)
  • Manually tested GUI on Windows with DeepSeek API (tool approval, streaming, chat input, file navigation)

Checklist

  • Updated docs or comments as needed (readme / code comments where applicable)
  • Added or updated tests where relevant (UI tests will be added in a follow-up PR due to complexity)
  • Verified TUI behavior manually if UI changes

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a native GUI for DeepSeek TUI built with egui and eframe, refactoring the core logic into a shared library. The GUI features a chat interface, file explorer, and code editor. However, the submission contains several critical issues, including unresolved merge conflict markers across multiple files and widespread character encoding corruption in the TUI source. Feedback highlights significant performance bottlenecks in the GUI, such as synchronous disk I/O (reading directories and saving files) performed on the main UI thread and redundant font/style loading every frame. Additionally, the event forwarding logic is inefficient and should transition from a polling loop to an asynchronous receiver to reduce latency and CPU usage.

Comment thread crates/tui/src/main.rs Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread crates/tui/src/deepseek_theme.rs Outdated
Comment thread crates/tui/src/deepseek_theme.rs Outdated
Comment thread crates/tui/src/main.rs Outdated
Comment thread crates/tui/src/main.rs Outdated
Comment thread crates/gui/src/app.rs Outdated
Comment thread crates/gui/src/app.rs Outdated
Comment thread crates/gui/src/app.rs Outdated
jwandbj added 8 commits May 6, 2026 10:29
- Moved directory reading (std::fs::read_dir) off the UI thread by spawning
  a background task (tokio::task::spawn_blocking) and caching results.
  This prevents GUI stutter when expanding large directories.
- Replaced the polling-based event forwarding loop (try_recv + sleep(50ms))
  with an async receiver (tokio::sync::mpsc) to eliminate latency and
  unnecessary CPU usage.
- Wrapped file saving (std::fs::write) in spawn_blocking to avoid blocking
  the UI thread during writes, especially for large files or slow disks.
@Hmbown Hmbown closed this May 6, 2026
@Hmbown Hmbown reopened this May 6, 2026
@Hmbown
Copy link
Copy Markdown
Owner

Hmbown commented May 7, 2026

Thanks for the GUI overhaul — the syntax-highlighting + tool-approval-modal + i18n work each look like genuinely useful self-contained slices inside the larger 3.5K-line PR. I'd like to harvest these one slice at a time in v0.8.18 and v0.9.0. The first one I'd take is the syntax-highlighting layer because it's the most self-contained; the approval-modal redesign is second because it touches user-facing flows we've been wanting to clean up.

I'll drive the harvest myself rather than asking you to split — just leaving this open as the source. Will credit you on each landed slice.

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