Skip to content

copyToClipboard fires on single click without selection #108

@EugenEistrach

Description

@EugenEistrach

Clicking on any terminal cell triggers SelectionManager.copyToClipboard, even when there's no text selected. This overwrites the user's clipboard with empty or single-character content unexpectedly.

The issue is in SelectionManager - copyToClipboard is called without checking if there's an actual selection (start cell ≠ end cell).

Proposed fix - check hasSelection() before copying:

async copyToClipboard(text: string) {
  if (!this.hasSelection()) {
    return;
  }
  // existing copy logic
}

Note: This fix was developed during an AI-assisted session and is currently used as a monkey-patch in our application. Due to time constraints we're unable to submit a proper PR, but wanted to share the finding.

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