File tree Expand file tree Collapse file tree 3 files changed +8
-5
lines changed
Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -857,9 +857,9 @@ def get_selected_text(self) -> str | None:
857857 for widget , selection in self .selections .items ():
858858 selected_text_in_widget = widget .get_selection (selection )
859859 if selected_text_in_widget is not None :
860- widget_text .append (selected_text_in_widget )
860+ widget_text .extend (selected_text_in_widget )
861861
862- selected_text = "\n " .join (widget_text )
862+ selected_text = "" .join (widget_text )
863863 return selected_text
864864
865865 def action_copy_text (self ) -> None :
Original file line number Diff line number Diff line change @@ -3816,21 +3816,21 @@ def visual_style(self) -> VisualStyle:
38163816 strike = style .strike ,
38173817 )
38183818
3819- def get_selection (self , selection : Selection ) -> str | None :
3819+ def get_selection (self , selection : Selection ) -> tuple [ str , str ] | None :
38203820 """Get the text under the selection.
38213821
38223822 Args:
38233823 selection: Selection information.
38243824
38253825 Returns:
3826- Extracted text, or `None` if no text could be extracted.
3826+ Tuple of extracted text and ending (typically " \n " or " ") , or `None` if no text could be extracted.
38273827 """
38283828 visual = self ._render ()
38293829 if isinstance (visual , (Text , Content )):
38303830 text = str (visual )
38313831 else :
38323832 return None
3833- return selection .extract (text )
3833+ return selection .extract (text ), " \n "
38343834
38353835 def _render_content (self ) -> None :
38363836 """Render all lines."""
Original file line number Diff line number Diff line change @@ -566,6 +566,9 @@ class MarkdownBullet(Widget):
566566 symbol = reactive ("\u25cf " )
567567 """The symbol for the bullet."""
568568
569+ def get_selection (self , _selection ) -> tuple [str , str ] | None :
570+ return self .symbol , " "
571+
569572 def render (self ) -> Text :
570573 return Text (self .symbol )
571574
You can’t perform that action at this time.
0 commit comments