Unexpected Middle Button behaviour after "Putty Style Paste" selected

Asked by David Goldfarb on 2017-05-07

Like others I use the "right click to paste" functionality of PuTTY and Terminator after having used the "edit terminal.py" hack for over a year. The "middle button" is hard to access on a Laptop with a trackpad and 2 buttons (simultaneous click doesn't always work), and I switch from Linux to Windows frequently.

I recently installed Fedora25 which uses the gtk3 branch of the code and found that this hack is no longer needed as it is now an Option. Great!

Note that I also have "copy on selection" checked in the Profile

But, I find that after selecting "PuTTY style Paste", the middle/right buttons didn't swap functionality as expected.

With PuTTY style paste unchecked, I have:

MIDDLE: un-shifted: paste shifted: paste
RIGHT: un-shifted: popup menu shifted: popup menu

With PuTTY style paste checked, I have:

MIDDLE: un-shifted: paste shifted: popup menu
RIGHT: un-shfited: paste shifted: paste

The question is why the "un-shifted MIDDLE" does the 'paste' operation instead of popup-menu with PuTTY style paste checked?

I found in the code the revision 1665 which adds a call to Vte.Terminal.do_button_press_event(self.vte, event) in un-shifted/un-ctrl is what does the paste instead of the popup menu.

If I remove the call to that method or change it to require SHIFT, the behaviour is what I expected: un-shifted MIDDLE will give the popup menu.


Question information

English Edit question
Terminator Edit question
No assignee Edit question
Last query:
Last reply:

Can't decide if I consider this as incorrect. I'm trying to think if PuTTY does a pop-up menu on unshifted middle click. If I recall correctly it is actually used to extend the current selection, but I'll need to check later. (Usually Shifted Left-click is used for extending the selection under Linux.) Not sure if it will be possible to completely mimic PuTTY's mode of operation, as it would involve over-riding quite a few normal actions.

David Goldfarb (dwgoldfarb) said : #2

Thanks for the quick response. The confusion I had was that I expected that "PuTTY style Paste" would simply reverse the buttons 2/3, as most users of the "hack" are used to, but the setting does more than that currently.

I looked at the bug report which prompted revision 1665 "middle mouse button not passed to tmux" (https://bugs.launchpad.net/terminator/+bug/1647507) which talks about turning on Mouse Events with echo -e "\e[?1000h".

If I paste that into a Terminator Bash session then all of the buttons behave differently sending terminal control chars to the applications.

I think it would be clearer if there are separate options:
"PuTTY style Paste" -- switch buttons 2/3 many people using the former hack are used to
"Mouse buttons to Vte" -- send all events to 'Vte.Terminal.do_button_press_event(self.vte, event) ' function.

The two options are mutually exclusive and could be a "select" instead of checkboxes. Implemented as "checkboxes" logic would be something like:
        if self.config['putty_paste_style']:
            middle_click = [self.popup_menu, (widget, event)]
            right_click = [self.paste_clipboard, (use_primary, )]
            middle_click = [self.paste_clipboard, (use_primary, )]
            right_click = [self.popup_menu, (widget, event)]

        if event.button == self.MOUSEBUTTON_LEFT:
        elif event.button == self.MOUSEBUTTON_MIDDLE:
            if self.config['send_mouse_events_to_vte']: <<<<<<<<<<<<<<< new option
                   return Vte.Terminal.do_button_press_event(self.vte, event)
        elif event.button == self.MOUSEBUTTON_RIGHT:
            if self.config['send_mouse_events_to_vte']: <<<<<<<<<<<<<<< new option
                   return Vte.Terminal.do_button_press_event(self.vte, event)

Just a suggestion...I have already made it work the way I need.

Thanks again.

Brendan Holmes (whiling) said : #3

Would be good to get this fixed. My experience of Putty Style Paste is middle-click and right-click both paste. Hence access to the menu is lost.

Shift-middle brings up the menu. But I only figured I could access the menu this way because of this thread. Anyone who doesn't read this, will be stuck without access to Preferences. I had to edit my ~/.config/terminator.conf to disable Putty Style Paste. Middle click should bring up the menu without having to shift.

Can you help with this problem?

Provide an answer of your own, or ask David Goldfarb for more information if necessary.

To post a message you must log in.