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
A collection of TUI enhancements focused on improving scroll behavior, diff view accuracy, session state management, and rendering robustness.
Changes
Scroll & Navigation Improvements
scroll_lines_from_endtracking and ablock_stay_at_bottom_framescounter to maintain the user's scroll position even as content grows (e.g., while a tool is still streaming output).ShowConfirmationDialogevent, so the scroll target is accurate.Diff View — Correct Line Numbers
extract_starting_line_from_diff()to parse@@ -N +N @@hunk headers from the tool call result string, giving accurate line offsets.find_starting_line_in_file()which locatesold_strin the actual file to determine the starting line when no diff result is available (preview case).resultparameter: Updatedrender_file_diff_full,render_diff_result_block,render_file_diff_block_from_args, andpreview_diff_from_stringsto accept and use the starting line information throughout the rendering pipeline.render_full_content_message: Changed fromrender_collapsed_messagetorender_full_content_messageforstr_replace/createresults so the fullToolCallResult(including the result text with line numbers) is preserved.Session State Management
/new), resuming a session (/resume), switching profiles, or using the reset command (Ctrl+L). This prevents stale data from a previous session leaking into the side panel.Shell Mode & Terminal
needs_terminal_clearflag that triggers a full terminal clear and redraw after the interactive shell popup exits, cleaning up any leaked output (e.g., sudo password prompts).Markdown & Rendering
|but not ending with|will pull in continuation lines until a closing|is found or a new row begins).SPACING_MARKERin closing tag replacement: Closing XML tags (exceptcheckpoint_id) are now replaced with an empty string instead of"SPACING_MARKER", avoiding spurious marker text in rendered output.Approval Bar
already_in_barcheck with the internaladd_actiondedup logic.Side Panel
available_widthin the changeset section now usessaturating_sub(1)to prevent off-by-one overflow at the panel edge.Pending Command Preview
render_run_command_blocknow uses aColor::Cyanborder forRunCommandState::Pending, visually distinguishing previews from completed/errored commands.Files Changed (15 files)
tui/src/app.rsscroll_to_last_message_start,block_stay_at_bottom_frames,scroll_lines_from_end, andneeds_terminal_clearfields toAppStatetui/src/event_loop.rsrender_full_content_messagefor diff results; handleneeds_terminal_cleartui/src/services/approval_bar.rstui/src/services/bash_block.rsresultparameter to diff rendering functions; added Cyan border for pending command statetui/src/services/commands.rs/resumeand/newtui/src/services/file_diff.rsextract_starting_line_from_diff,find_starting_line_in_file; updatedpreview_diff_from_stringsandrender_file_diff_block_from_argsto use starting line offsettui/src/services/handlers/dialog.rsscroll_to_last_message_startwhen approval bar first appears; simplified dedup logictui/src/services/handlers/input.rsCtrl+L)tui/src/services/handlers/navigation.rsscroll_to_last_message_startlogic withlines_from_endtracking andblock_stay_at_bottom_framescountertui/src/services/handlers/popup.rstui/src/services/handlers/shell.rsneeds_terminal_clearon shell popup completiontui/src/services/handlers/tool.rsscroll_to_last_message_starton tab next/prev in approval bartui/src/services/markdown_renderer.rsSPACING_MARKERwith empty string for closing tagstui/src/services/message.rsRenderCollapsedMessageandRenderFullContentMessageto use diff view with line numbers forstr_replace/createtui/src/services/side_panel.rssaturating_sub(1)Tests
No new tests were added in this branch. The changes are UI/TUI-focused (scroll behavior, rendering, state management) which are validated through manual testing. Existing tests were not modified.
All validation checks pass:
cargo checkcargo clippycargo fmt --checkcargo testCommits (8 non-merge)
SPACING_MARKERwith an empty string when removing markdown closing tags