File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88
99import pyperclip
1010from textual .app import App
11+ from textual .widgets import TextArea
1112
1213_PREVIEW_MAX_LENGTH = 40
1314
@@ -128,6 +129,12 @@ def _get_selected_texts(app: App) -> list[str]:
128129 selected_texts = []
129130
130131 for widget in app .query ("*" ):
132+ if isinstance (widget , TextArea ):
133+ selected_text = widget .selected_text
134+ if selected_text and selected_text .strip ():
135+ selected_texts .append (selected_text )
136+ continue
137+
131138 if not hasattr (widget , "text_selection" ) or not widget .text_selection :
132139 continue
133140
Original file line number Diff line number Diff line change @@ -1683,7 +1683,7 @@ async def _check_update(self) -> None:
16831683 )
16841684
16851685 def action_copy_selection (self ) -> None :
1686- copied_text = copy_selection_to_clipboard (self , show_toast = False )
1686+ copied_text = copy_selection_to_clipboard (self , show_toast = True )
16871687 if copied_text is not None :
16881688 self .agent_loop .telemetry_client .send_user_copied_text (copied_text )
16891689
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ async def test_ctrl_y_triggers_copy_selection() -> None:
1717 ) as mock_copy :
1818 async with app .run_test () as pilot :
1919 await pilot .press ("ctrl+y" )
20- mock_copy .assert_called_once_with (app , show_toast = False )
20+ mock_copy .assert_called_once_with (app , show_toast = True )
2121
2222
2323@pytest .mark .asyncio
@@ -30,7 +30,7 @@ async def test_ctrl_shift_c_triggers_copy_selection() -> None:
3030 ) as mock_copy :
3131 async with app .run_test () as pilot :
3232 await pilot .press ("ctrl+shift+c" )
33- mock_copy .assert_called_once_with (app , show_toast = False )
33+ mock_copy .assert_called_once_with (app , show_toast = True )
3434
3535
3636@pytest .mark .asyncio
You can’t perform that action at this time.
0 commit comments