[vim/vim] GTK4: primary selection paste returns our own text (PR #20261)

2 views
Skip to first unread message

mattn

unread,
May 20, 2026, 1:26:04 AM (2 days ago) May 20
to vim/vim, Subscribed

With GTK4, after gvim owns the primary selection, pasting from another app via middle-click or \"*p returned gvim's own previously-selected text instead of the new owner's content. The X11 SelectionClear path no longer applies because GTK4 abstracts the clipboard through GdkClipboard, and we were not listening for ownership changes — so GdkClipboard kept returning its locally cached content.

This patch connects to ::changed on both gdk_display_get_primary_clipboard() and gdk_display_get_clipboard() in gui_mch_init(), and calls clip_lose_selection() whenever the change was not driven by us (gdk_clipboard_is_local() is false). A small re-entry flag prevents clip_mch_set_selection() from triggering its own loss callback.

Implemented purely through GdkClipboard, no X11-specific code.

Fixes #20256


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/20261

Commit Summary

  • fee847b GTK4: pasting primary selection from another app returns our own text

File Changes

(1 file)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20261@github.com>

Christian Brabandt

unread,
May 21, 2026, 5:02:25 PM (17 hours ago) May 21
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#20261)

@lilydjwg ?


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20261/c4512734867@github.com>

Reply all
Reply to author
Forward
0 new messages