Skip to content

onSelectionChange() is not being invoked when the selection is cleared. #3193

@BitStream1

Description

@BitStream1

Awesome JS terminal emulator - thanks for your contribution. I did notice the following (minor) bug today:

When adjusting the selection in the terminal, I see onSelectionChange() being triggered as expected. However, if I left-click with the mouse on the terminal (with no drag), the selection is cleared, but onSelectionChange() is NOT triggered as would be expected.

This may have been the original intent of the following issue, but the description in the issue is sparse and may have been misinterpreted.
#2070

Details

  • Browser and browser version: Chrome 87.0.4280.88, but not expected to be browser specific
  • OS version: Windows 10 Pro, version 1903, but not expected to be OS specific
  • xterm.js version: 4.9.0

Steps to reproduce:

  1. Setup an development environment that can run an xterm.js terminal.
  2. After opening the terminal, add the following code:
        terminal.onSelectionChange(() => {
            console.log('onSelectionChange', terminal.getSelection());
        });
  1. Run the application and select text with the mouse. Observe onSelectionChange being called with the selected text logged.
  2. Click on the terminal (with no drag). Observe the selection has now been cleared. Observe that onSelectionChange is NOT called.
  3. I think the expected behavior would be to call onSelectionChange for consistency reasons, as the selection has changed, right?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions