@@ -1014,8 +1014,17 @@ def paste_selection_or_clipboard(self) -> None:
10141014
10151015 Requires :ref:`shell_integration` to work
10161016 ''' )
1017- def mouse_select_cmd_output (self ) -> None :
1018- click_mouse_cmd_output (self .os_window_id , self .tab_id , self .id )
1017+ def mouse_select_command_output (self ) -> None :
1018+ click_mouse_cmd_output (self .os_window_id , self .tab_id , self .id , True )
1019+
1020+ @ac ('mouse' , '''
1021+ Show clicked command output in a pager like less
1022+
1023+ Requires :ref:`shell_integration` to work
1024+ ''' )
1025+ def mouse_show_command_output (self ) -> None :
1026+ if click_mouse_cmd_output (self .os_window_id , self .tab_id , self .id , False ):
1027+ self .show_cmd_output (CommandOutput .last_visited , 'Clicked command output' )
10191028 # }}}
10201029
10211030 def text_for_selection (self ) -> str :
@@ -1087,35 +1096,35 @@ def show_scrollback(self) -> None:
10871096 cursor_on_screen = self .screen .scrolled_by < self .screen .lines - self .screen .cursor .y
10881097 get_boss ().display_scrollback (self , data ['text' ], data ['input_line_number' ], report_cursor = cursor_on_screen )
10891098
1099+ def show_cmd_output (self , which : CommandOutput , title : str = 'Command output' , as_ansi : bool = True , add_wrap_markers : bool = True ) -> None :
1100+ text = self .cmd_output (which , as_ansi = as_ansi , add_wrap_markers = add_wrap_markers )
1101+ text = text .replace ('\r \n ' , '\n ' ).replace ('\r ' , '\n ' )
1102+ get_boss ().display_scrollback (self , text , title = title , report_cursor = False )
1103+
10901104 @ac ('cp' , '''
10911105 Show output from the first shell command on screen in a pager like less
10921106
10931107 Requires :ref:`shell_integration` to work
10941108 ''' )
10951109 def show_first_command_output_on_screen (self ) -> None :
1096- text = self .cmd_output (CommandOutput .first_on_screen , as_ansi = True , add_wrap_markers = True )
1097- text = text .replace ('\r \n ' , '\n ' ).replace ('\r ' , '\n ' )
1098- get_boss ().display_scrollback (self , text , title = 'First command output on screen' , report_cursor = False )
1110+ self .show_cmd_output (CommandOutput .first_on_screen , 'First command output on screen' )
10991111
11001112 @ac ('cp' , '''
11011113 Show output from the last shell command in a pager like less
11021114
11031115 Requires :ref:`shell_integration` to work
11041116 ''' )
11051117 def show_last_command_output (self ) -> None :
1106- text = self .cmd_output (CommandOutput .last_run , as_ansi = True , add_wrap_markers = True )
1107- text = text .replace ('\r \n ' , '\n ' ).replace ('\r ' , '\n ' )
1108- get_boss ().display_scrollback (self , text , title = 'Last command output' , report_cursor = False )
1118+ self .show_cmd_output (CommandOutput .last_run , 'Last command output' )
11091119
11101120 @ac ('cp' , '''
1111- Show the first output below the last scrolled position via scroll_to_prompt in a pager like less
1121+ Show the first command output below the last scrolled position via scroll_to_prompt
1122+ or the last mouse clicked command output in a pager like less
11121123
11131124 Requires :ref:`shell_integration` to work
11141125 ''' )
11151126 def show_last_visited_command_output (self ) -> None :
1116- text = self .cmd_output (CommandOutput .last_visited , as_ansi = True , add_wrap_markers = True )
1117- text = text .replace ('\r \n ' , '\n ' ).replace ('\r ' , '\n ' )
1118- get_boss ().display_scrollback (self , text , title = 'Last visited command output' , report_cursor = False )
1127+ self .show_cmd_output (CommandOutput .last_visited , 'Last visited command output' )
11191128
11201129 def paste_bytes (self , text : Union [str , bytes ]) -> None :
11211130 # paste raw bytes without any processing
0 commit comments