File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ def copy(self, human_input):
108108 if not self .code_blocks :
109109 self .console .print ("No code blocks to copy." , style = self .console .error_style )
110110 else :
111- pyperclip .copy (self .code_blocks )
111+ pyperclip .copy (" \n " . join ( self .code_blocks ) )
112112 self .console .print (Panel ("✅ Copied code blocks to clipboard." ))
113113 return self .CONTINUE
114114
Original file line number Diff line number Diff line change 44from io import StringIO
55from pathlib import Path
66from tests .conftest import in_temp_directory
7- import pytest , textwrap
7+ import pyperclip , pytest , textwrap
88
99
1010class MockConsole :
@@ -88,3 +88,14 @@ def test_apply_subcommand(chat, temp_git_repo):
8888
8989 # Check if the file was properly modified
9090 assert "It is now even better!" in mod_file .read_text ()
91+
92+
93+ def test_copy_subcommand (chat , temp_git_repo ):
94+ with in_temp_directory (temp_git_repo .working_dir ):
95+ # Add the patch to the chat (simulating it coming in from the LM response)
96+ chat .code_blocks = ["code block 1" , "code block 2" ]
97+
98+ # Apply the patch using the /apply command
99+ assert chat .parse_human_input ("/copy" ) == chat .CONTINUE
100+
101+ assert pyperclip .paste () is "\n " .join (chat .code_blocks )
You can’t perform that action at this time.
0 commit comments