Skip to content

bug: closing tabs with middle button pastes primary selection into the buffer #498

Closed

Description

@ribal-gz

When I close a tab using the middle mouse button on Linux, the contents of the PRIMARY selection are pasted into the newly active buffer.

  • ZenNotes version: 2.19.0
  • Display server: wayland
zennotes_bug.mp4

Activity

  1. adibhanna commented on Jul 29, 2026

    @adibhanna
    Contributor

    Fixed for 2.20.0.

    What was happening: on Linux the middle button is two gestures at once, close the tab and paste the PRIMARY selection. The tab strip already cancelled its own mousedown and auxclick, but under Wayland Chromium can deliver that paste to the focused editor rather than to the element under the pointer, so cancelling events on the tab never reached it and the selection landed at the caret of whichever note took over after the close.

    The fix cancels the middle-button mouseup as well, and arms a short-lived guard when a middle-click closes a tab: it catches the paste event itself wherever it is delivered (one paste, inside a 150ms window, then it disarms), so a paste you actually ask for is never affected.

    One honest caveat: this was verified at the event level in the real build (the paste that rides the click is cancelled, later pastes are untouched), but there is no Wayland machine here to run your exact repro on. If you still see it on 2.20.0, please reopen and I will dig further. Thanks for the report and the clean video, it pinned the "focused editable, not pointer position" detail that explained why the standard defense was not enough.

  2. adibhanna commented on Jul 29, 2026

    @adibhanna
    Contributor

    The fix is now public on the release branch: 31dd042 (lands in 2.20.0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions