Skip to content

Copy message from context menu includes rail decorations (● ▏) — make it rail-clean like selection copy #5314

Description

@maimik

Description

In the TUI (v0.9.5), the context-menu action "Copy message" (right-click on a transcript cell → Copy message) copies the message including UI decorations: the first line carries the role glyph , and every wrapped continuation line is prefixed with the rail character (U+258F + space). Example of what lands on the clipboard:

● Готово. Эпопея закрыта.
▏ 
▏ Навык обновлён — урок про «живой тест после каждого патча» зафиксирован в search-files-windows-fix.
▏ 
▏ MEMORY обновлён — правило: «похожее место ≠ нужное место».

This makes pasting the copied text into another document/chat/editor noisy — the user has to strip / manually.

Use Case

"Copy message" is the natural way to grab a whole assistant reply for reuse outside CodeWhale. The user expects clean text, exactly like the in-app selection copy already provides (rail-clean since #4208 — "In-app selection copy is rail-clean and now regression-tested: copied transcript text excludes the ▎ ╎ │ ● decorations via cache metadata").

Today there is a mismatch: selection copy is clean, "Copy message" is not. There is also no config option to change the copy-message behavior ([tui] has no copy-related keys; mouse_capture only affects who owns mouse selection).

Suggested Fix

Make the context-menu "Copy message" path rail-clean the same way selection copy is:

  • copy_cell_to_clipboard currently renders via history_cell_to_texttranscript_linesline_to_string, which keeps the role glyph and rail spans.
  • Selection copy (selection_to_text) already strips them using cache metadata (rail_prefix_width + copy_prefix_width).
  • Reuse that same metadata-based stripping for the cell-copy path, so "Copy message" exports only the plain message text (including code blocks, markdown source as-is, without the / decorations).

An opt-in config flag (e.g. [tui] copy_cell_plain = true, default true) would be a nice escape hatch if anyone actually wants the decorated copy, but the clean text should be the default.

Environment

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions