You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Code block copy button adds trailing newline(s), so a pasted one-line command becomes multi-line #37268
Get an assistant reply with a one-line fenced shell block, e.g. sudo pacman -S patchelf.
Click the code block's copy button.
Inspect the clipboard: wl-paste | od -c.
Expected behavior
The clipboard holds the command without a trailing newline (sudo pacman -S patchelf), so pasting a single-line command gives a single-line command.
Actual behavior
The clipboard holds sudo pacman -S patchelf\n\n. Shells with a multi-line editor (ble.sh, also fish and zsh with bracketed paste) then treat the pasted command as multi-line: Enter inserts a newline instead of running it, and you have to use the "run" key (C-j in ble.sh) instead.
MarkdownCodeBlock.tsx copies the fence text exactly as given, and that text always ends in \n:
const handleCopy = () => copyToClipboard(code);
(The run-in-terminal check a few lines above even relies on code.endsWith("\n").)
Suggested fix: copy code.replace(/\n+$/, ""), keeping the raw code for the run-in-terminal path.
Impact
Every copied one-line command needs an extra keystroke, or the trailing newline deleted by hand, in shells that support multi-line editing.
Version or commit
v0.1.9 (AppImage). Still present on main as of a621be8.
Environment
Arch Linux, Hyprland (Wayland), foot + bash with ble.sh.
Workaround
A ble.sh Enter binding that strips trailing newlines before accepting the line.
Activity