Paste from clipboard with middle mouse button/wheel

0 votes
asked May 9 by sigipa (120 points)

Hi,

Is it possible to change clipboard paste from right mouse button to middle mouse button/wheel?

Thanks,
-S

1 Answer

0 votes
answered May 9 by Lukas Matyska (46,810 points)

Unfortunately, there is no option to modify this. But you can do it manually like this:

// disable default mouse paste
terminal.MousePasteEnabled = false;

// define mouse paste for middle button
terminal.MouseClick += (s, e) =>
{
    if (e.Button == MouseButtons.Middle)
    {
        // get text from clipboard
        string text = null;
        if (Clipboard.ContainsText(TextDataFormat.Text) ||
            Clipboard.ContainsText(TextDataFormat.UnicodeText))
            text = Clipboard.GetText();

        if (text != null)
        {
            try
            {
                // send text to server
                terminal.Scripting.Send(text);
            }
            catch
            {
                // handle pasting errors if necessary
            }
        }
    }
};
...