File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -569,12 +569,19 @@ def render_line(self, y: int) -> Strip:
569569 if char == " " :
570570 result .stylize (style , index , index + 1 )
571571
572- if self ._cursor_visible and self .has_focus :
573- if self ._cursor_at_end :
574- result .pad_right (1 )
575- cursor_style = self .get_component_rich_style ("input--cursor" )
576- cursor = self .cursor_position
577- result .stylize (cursor_style , cursor , cursor + 1 )
572+ if self .has_focus :
573+ if not self .selection .is_empty :
574+ start , end = self .selection
575+ start , end = sorted ((start , end ))
576+ selection_style = self .get_component_rich_style ("input--selection" )
577+ result .stylize_before (selection_style , start , end )
578+
579+ if self ._cursor_visible :
580+ cursor_style = self .get_component_rich_style ("input--cursor" )
581+ cursor = self .cursor_position
582+ if self ._cursor_at_end :
583+ result .pad_right (1 )
584+ result .stylize (cursor_style , cursor , cursor + 1 )
578585
579586 segments = list (result .render (self .app .console ))
580587 line_length = Segment .get_line_length (segments )
You can’t perform that action at this time.
0 commit comments