feat(tui): sidebar polish, ESC navigation, syntax highlighting fix, auto-open#33
Merged
Conversation
… input Tool inline display: - Add syntax-highlighted code previews with line numbers (chroma, dracula theme) - Add diff coloring (+/- lines) for edit_file, write_file, apply_patch - Add bash inline preview: `$ cmd` + output, truncated to 10 lines - Remove border boxes from all inline previews (no panelBox wrapper) - Auto-expand write_file, edit_file, apply_patch, bash, spawn_agent on completion - read_file closed by default; removed from auto-expand list - Fix per-line truncation in renderCodeBody to prevent overflow (ansi.Truncate) - Fix renderPlainBody/renderBashInline split-before-escape bug - Adjust bodyWidth to account for removed border (width-4 instead of width-8) Permission dialog: - Redesign as wide centered overlay (60–110 cols) with yellow border - Show tool name, working directory, file/URL/command context - Show diff preview for edit/write/patch, code block for bash - Remove //// fill from header - Replace bordered buttons with simple colored [y]/[a]/[n] key labels (right-aligned) - Add drop shadow (░ chars) for visual elevation without background color - Propagate engine Metadata (tool_name, tool_input, working_directory) through PromptRequestMsg so the dialog has full context Input auto-grow: - Fix resizeInput() to count visual wrap lines, not just explicit newlines - A long line that wraps due to width now correctly grows the textarea - Input expands row by row up to maxHeight=10 then becomes scrollable
… input Tool inline display: - Add syntax-highlighted code previews with line numbers (chroma, dracula theme) - Add diff coloring (+/- lines) for edit_file, write_file, apply_patch - Add bash inline preview: `$ cmd` + output, truncated to 10 lines - Remove border boxes from all inline previews (no panelBox wrapper) - Auto-expand write_file, edit_file, apply_patch, bash, spawn_agent on completion - read_file closed by default; removed from auto-expand list - Fix per-line truncation in renderCodeBody to prevent overflow (ansi.Truncate) - Fix renderPlainBody/renderBashInline split-before-escape bug - Adjust bodyWidth to account for removed border (width-4 instead of width-8) Permission dialog: - Redesign as wide centered overlay (60–110 cols) with yellow border - Show tool name, working directory, file/URL/command context - Show diff preview for edit/write/patch, code block for bash - Remove //// fill from header - Replace bordered buttons with simple colored [y]/[a]/[n] key labels (right-aligned) - Add drop shadow (░ chars) for visual elevation without background color - Propagate engine Metadata (tool_name, tool_input, working_directory) through PromptRequestMsg so the dialog has full context Input auto-grow: - Fix resizeInput() to count visual wrap lines, not just explicit newlines - A long line that wraps due to width now correctly grows the textarea - Input expands row by row up to maxHeight=10 then becomes scrollable
Sidebar layout & overflow: - Fix root cause of sidebar overflowing terminal width: relayout() now sizes the chat viewport at chatW (not contentW) when sidebar is open, so leftContent is exactly chatW wide and JoinHorizontal stays within contentW bounds - Clamp all sidebar header lines to innerW via ansi.Truncate; truncate file-path labels in detailBody to prevent box expansion - Lower innerW minimum from 24 to 10 (removes artificial floor) - Soft-wrap code lines in the detail sidebar with continuation indent (numColW spaces); inline preview still truncates for compact height Sidebar mouse scroll: - Switch from a full pointInRect check to X-coordinate-only detection: any wheel event with msg.X >= detailX goes to the sidebar viewport. The Y-range check was unreliable due to minor height-computation differences between Update and View cycles Auto-open sidebar: - AddToolProgress opens detailOpen=true when a new auto-expand tool (write_file, edit_file, apply_patch, bash, spawn_agent) is created - Model detects the state change and calls relayout() automatically so the chat width is immediately narrowed to match the new layout ESC key behaviour: - ESC while agent is busy (m.busy=true): cancel the running agent - ESC in uiFocusMain with sidebar open: close sidebar (existing) - ESC in uiFocusMain with sidebar closed, agent idle: go to Home page - ESC in uiFocusEditor, agent idle: go to Home page - Permission dialog ESC still denies the pending permission Syntax highlighting fix: - renderCodeBody: when chroma trims a trailing newline (last display line is blank → join produces trailing \n → TrimRight removes it → one fewer output line), pad hlLines back to len(display) with empty strings instead of falling back to uncolored plain text list_directory: - FormatResult now emits JSON instead of Go map fmt.Sprintf, so the TUI can parse structured directory data correctly Permission dialog: - Scrollable preview (↑↓/pgup/pgdn), markdown via glamour, diff with full-row green/red backgrounds, fixed Deny button split-line bug examples: - Add pathfinding_demo Python project (BFS + A* on a 20×20 grid) - Add research documents to examples/researchs/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
relayout()now sizes the chat viewport atchatW(notcontentW) when the sidebar is open, soJoinHorizontalalways stays within terminal bounds. Header lines and file-path labels are clamped toinnerWviaansi.Truncate.pointInRectcheck (X+Y) to X-coordinate-only detection — any wheel event withmsg.X >= detailXscrolls the sidebar. The previous Y-range check was silently failing due to minor height-computation differences between Update and View cycles.AddToolProgresssetsdetailOpen = truewhen a new auto-expand tool (write_file,edit_file,apply_patch,bash,spawn_agent) is created; the model callsrelayout()immediately.numColWspaces; inline preview still truncates for compact height.renderCodeBodynow padshlLinestolen(display)when chroma trims a trailing newline (blank last line → length mismatch → old code fell back to plain white text).list_directoryJSON output:FormatResultnow emits JSON so the TUI can parse structured directory data.pathfinding_demoPython project and research documents.Test plan
go build ./...passesgo test -race ./... -timeout 300s— all greengofmt -l .— no unformatted filesgo vet ./...— cleangolangci-lint run --timeout=5m— clean