@@ -765,25 +765,40 @@ const writePtyInput = (pty: PtyBridge | null, data: string): void => {
765765
766766const shellQuote = ( value : string ) : string => `'${ value . replace ( / ' / gu, "'\\''" ) } '`
767767
768- const tmuxRightClickPaneBindings : ReadonlyArray < string > = [ "MouseDown3Pane" , "M-MouseDown3Pane" ]
769- const tmuxRightClickStatusBindings : ReadonlyArray < string > = [
768+ const tmuxRightClickForwardPredicate =
769+ "#{||:#{mouse_any_flag},#{&&:#{pane_in_mode},#{?#{m/r:(copy|view)-mode,#{pane_mode}},0,1}}}"
770+ const tmuxRightClickPaneBindings : ReadonlyArray < string > = [
771+ "MouseDown3Pane" ,
772+ "MouseDrag3Pane" ,
773+ "MouseDragEnd3Pane" ,
774+ "MouseUp3Pane" ,
775+ "M-MouseDown3Pane" ,
776+ "M-MouseDrag3Pane" ,
777+ "M-MouseDragEnd3Pane" ,
778+ "M-MouseUp3Pane"
779+ ]
780+ const tmuxRightClickSuppressBindings : ReadonlyArray < string > = [
770781 "MouseDown3Status" ,
771782 "MouseDown3StatusLeft" ,
783+ "MouseDown3StatusRight" ,
784+ "MouseDown3Border" ,
772785 "M-MouseDown3Status" ,
773- "M-MouseDown3StatusLeft"
786+ "M-MouseDown3StatusLeft" ,
787+ "M-MouseDown3StatusRight" ,
788+ "M-MouseDown3Border"
774789]
775790
776791const renderTmuxPaneRightClickBinding = ( binding : string ) : string =>
777- `tmux bind-key -T root ${ binding } if-shell -F -t = ${ shellQuote ( "#{mouse_any_flag}" ) } ${
778- shellQuote ( "send-keys -M" )
792+ `tmux bind-key -T root ${ binding } if-shell -F -t = ${ shellQuote ( tmuxRightClickForwardPredicate ) } ${
793+ shellQuote ( "select-pane -t = ; send-keys -M" )
779794 } >/dev/null 2>&1 || true`
780795
781- const renderTmuxStatusRightClickUnbind = ( binding : string ) : string =>
796+ const renderTmuxRightClickSuppressBinding = ( binding : string ) : string =>
782797 `tmux unbind-key -T root ${ binding } >/dev/null 2>&1 || true`
783798
784799const renderTmuxRightClickBindingCommands = ( ) : ReadonlyArray < string > => [
785800 ...tmuxRightClickPaneBindings . map ( renderTmuxPaneRightClickBinding ) ,
786- ...tmuxRightClickStatusBindings . map ( renderTmuxStatusRightClickUnbind )
801+ ...tmuxRightClickSuppressBindings . map ( renderTmuxRightClickSuppressBinding )
787802]
788803
789804const writeBufferToProjectContainer = (
0 commit comments