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
Bug: Copying commands from code blocks includes invisible characters, causing "command not found" in external terminal
Description
When copying commands from Copilot CLI's rendered code blocks (using ctrl+c or right-click copy) and pasting them into another terminal tab, the pasted text contains invisible/hidden characters. This causes valid system commands like df and du to fail with "command not found", even though the commands appear visually correct.
Manually deleting the pasted text with Backspace and retyping the exact same command works perfectly.
Steps to Reproduce
Launch Copilot CLI (copilot) in a terminal tab (e.g., Windows Terminal + WSL)
Ask: "give me a linux command, calc the disk size"
Copilot responds with commands including df -h and du -sh . in code blocks
Select and copy df -h from the code block (ctrl+c / right-click copy)
Switch to a separate terminal tab (same WSL instance)
Paste the command and press Enter
Expected Behavior
df -h should execute normally and display filesystem disk usage.
Actual Behavior
$ df -h
Command 'df' not found, did you mean:
command 'wdf' from deb wit (3.01a-4.1)
command 'df' from deb coreutils (9.4-3ubuntu6.2)
command 'kdf' from deb kdf (4:23.08.4-0ubuntu1)
command 'sdf' from deb sdf (2.001+1-9)
Try: sudo apt install <deb name>
The same error occurs consistently when pasting. However, pressing Backspace to delete the entire line and manually retyping df -h succeeds immediately:
This also reproduces with du -sh . and du -sh /path/to/dir copied from the code blocks — same "command not found" error on paste, works fine when manually typed.
Additional Testing
Further manual testing confirms there is exactly one invisible character prepended before the visible command text:
After pasting df -h, move the cursor to the beginning of the line (Home key)
Press Right arrow once to move past the first "visible" character d
Press Backspace once to delete d, then retype d to restore the command → still fails
Move cursor to the beginning again, press Backspace twice (deleting both the invisible character and d), then retype d to restore the command → succeeds
This proves there is a single hidden/non-printable character at the very beginning of the copied text, before the first visible character. Deleting only the visible d and retyping it leaves the hidden character intact, so the command still fails. Deleting one extra character removes the hidden prefix, and the command works.
Root Cause Hypothesis
The copied text from Copilot CLI code blocks contains exactly one invisible Unicode character (e.g., zero-width space U+200B, BOM U+FEFF, or other non-printable character) prepended before the command text. This character is part of the terminal rendering but should be stripped when copying to clipboard.
Describe the bug
Bug: Copying commands from code blocks includes invisible characters, causing "command not found" in external terminal
Description
When copying commands from Copilot CLI's rendered code blocks (using
ctrl+cor right-click copy) and pasting them into another terminal tab, the pasted text contains invisible/hidden characters. This causes valid system commands likedfandduto fail with "command not found", even though the commands appear visually correct.Manually deleting the pasted text with Backspace and retyping the exact same command works perfectly.
Steps to Reproduce
copilot) in a terminal tab (e.g., Windows Terminal + WSL)df -handdu -sh .in code blocksdf -hfrom the code block (ctrl+c / right-click copy)Expected Behavior
df -hshould execute normally and display filesystem disk usage.Actual Behavior
The same error occurs consistently when pasting. However, pressing Backspace to delete the entire line and manually retyping
df -hsucceeds immediately:This also reproduces with
du -sh .anddu -sh /path/to/dircopied from the code blocks — same "command not found" error on paste, works fine when manually typed.Additional Testing
Further manual testing confirms there is exactly one invisible character prepended before the visible command text:
df -h, move the cursor to the beginning of the line (Home key)dd, then retypedto restore the command → still failsd), then retypedto restore the command → succeedsThis proves there is a single hidden/non-printable character at the very beginning of the copied text, before the first visible character. Deleting only the visible
dand retyping it leaves the hidden character intact, so the command still fails. Deleting one extra character removes the hidden prefix, and the command works.Root Cause Hypothesis
The copied text from Copilot CLI code blocks contains exactly one invisible Unicode character (e.g., zero-width space U+200B, BOM U+FEFF, or other non-printable character) prepended before the command text. This character is part of the terminal rendering but should be stripped when copying to clipboard.
Environment
Video Evidence
A screen recording demonstrating the issue is available. Key observations:
dfandduare affected (not command-specific)command-issues-bug-report_2026325212146.mp4
Affected version
No response
Steps to reproduce the behavior
No response
Expected behavior
No response
Additional context
No response