Skip to content

fix(tui): copy transcript selections without visual wraps#1906

Closed
knqiufan wants to merge 1 commit into
Hmbown:mainfrom
knqiufan:fix/issue-1853-clean-copy
Closed

fix(tui): copy transcript selections without visual wraps#1906
knqiufan wants to merge 1 commit into
Hmbown:mainfrom
knqiufan:fix/issue-1853-clean-copy

Conversation

@knqiufan
Copy link
Copy Markdown
Contributor

Summary

  • Fixes TUI: terminal-native copy includes visual line breaks from wrapped output #1853 by carrying copy-specific wrap metadata through markdown rendering and the transcript cache.
  • TUI-owned mouse selection now removes visual wrap breaks while preserving logical newlines, long words, code lines, and list continuation text.
  • Documents that raw terminal selection can still include visual wraps when mouse capture is bypassed.

Test plan

  • cargo test -p deepseek-tui --bin deepseek-tui selection_to_text
  • cargo test -p deepseek-tui --bin deepseek-tui mouse_selection_autocopies_on_release_without_ctrl_c
  • cargo clippy -p deepseek-tui --all-targets --all-features
  • Manual TUI check: with --mouse-capture, drag-copying a long assistant paragraph pastes as one logical paragraph.

Notes

  • cargo test -p deepseek-tui --bin deepseek-tui currently fails on unrelated config/skills tests in this local environment: change_in_non_english_without_api_key_uses_explicit_fallback, test_list_skills_empty_directory, test_list_skills_filters_by_name_prefix, and app_new_detects_missing_api_key_with_default_config.

Preserve logical transcript text when TUI-owned mouse selection copies wrapped assistant output.
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 enhances the TUI's copy-paste behavior by introducing metadata to distinguish between visual and logical line breaks. By tracking CopyLineSeparator and copy_prefix_width throughout the rendering pipeline, the selection logic can now remove soft-wrap newlines and strip visual prefixes from code blocks and lists, ensuring the copied text matches the source content. The changes include updates to history rendering, markdown processing, and the selection-to-text logic, along with new unit tests and documentation updates. I have no feedback to provide.

@Hmbown
Copy link
Copy Markdown
Owner

Hmbown commented May 26, 2026

Harvested in build/v0.8.47 (commit 236ad41). Thank you! Added to CHANGELOG.

@Hmbown Hmbown closed this May 26, 2026
Hmbown added a commit that referenced this pull request May 26, 2026
Harvested and vetted — no malware, no external deps, no injection:
- #1859 (@harvey2011888): loop guard now reports Failed on halt
- #1870 (@victorcheng2333): honour DEEPSEEK_YOLO env on startup
- #1935 (@IIzzaya): replace [x] with [✓] completion markers
- #1837 (@PurplePulse): fix macOS title centering (pin to top)
- #1967 (@cyq1017): show base_url in /config view
- #1906 (@knqiufan): copy transcript without visual-wrap newlines

Also fix cycle_manager archive_dir_for to use resolve_state_dir
so recall_archive tests pass with the migrated sessions path.

Co-authored-by: victorcheng2333 <victorcheng2333@users.noreply.github.com>
Co-authored-by: IIzzaya <IIzzaya@users.noreply.github.com>
Co-authored-by: PurplePulse <PurplePulse@users.noreply.github.com>
Co-authored-by: cyq1017 <cyq1017@users.noreply.github.com>
Co-authored-by: knqiufan <knqiufan@users.noreply.github.com>
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.

TUI: terminal-native copy includes visual line breaks from wrapped output

2 participants