Search code examples
clickx11pastekde-plasmakate

Middle click paste at cursor position in GUI programs


In most terminal applications (e.g. Konsole) one can select text with the mouse. A middle click will then pastes it at the current cursor position. The same happens when pasting with Shift+Ctrl+V.

In most GUI text editors (e.g. Kate) one can select text with the mouse. A middle click then pastes it at the current mouse pointer position. Pasting with Ctrl+V instead pastes at the current cursor position.

This difference in behaviour annoys me. I'd like to be able to paste at the cursor position at all times, even in GUI text editors (I use Kate so that's what I'm mostly concerned about).

Can this be done in any way? I realize that this seems to be a built-in X feature so it's difficult to work with.


Solution

  • I'm one of the Kate developers, and setting the text cursor on middle mouse button click is by design:

    2737    case Qt::MidButton:
    2738        placeCursor(e->pos());
    2739
    2740        if (doc()->isReadWrite()) {
    2741            QString clipboard = QApplication::clipboard()->text(QClipboard::Selection);
    2742            m_view->paste(&clipboard);
    2743        }
    

    If you want different behavior, please vote for the existing wish, or better yet provide a patch that implements this feature request.