Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement virtual selection #207

Closed
Tyriar opened this issue Jul 25, 2016 · 10 comments · Fixed by #670
Closed

Implement virtual selection #207

Tyriar opened this issue Jul 25, 2016 · 10 comments · Fixed by #670
Assignees
Labels
type/enhancement Features or improvements to existing features
Milestone

Comments

@Tyriar
Copy link
Member

Tyriar commented Jul 25, 2016

Handling selection manually, rather than relying on native web selection, will fix a bunch of issues that are introduced by the input helper text area, such as #68, #69 as well as:

  • Double clicking on the prompt line being flaky due to focus shifting from .xterm to the text area.
  • Double clicking on a URL/path to highlight the whole path (ie. don't use / and similar chars as separators)
  • Selecting and copying multiple pages of the buffer
  • Making the selection's line height exact so there are never any gaps between lines
  • Don't drop the selection when there's a content change or viewport scroll text-selection is lost when data is written outside of the viewport #468 (comment)
@Tyriar Tyriar added the type/enhancement Features or improvements to existing features label Jul 25, 2016
@parisk parisk added this to the 1.1.0 milestone Jul 26, 2016
@parisk
Copy link
Contributor

parisk commented Jul 26, 2016

Great. Adding this to the milestone for the next release.

@parisk
Copy link
Contributor

parisk commented Sep 29, 2016

Removed this from the milestone as most important reason for this to be there was the right-click copy/paste regression, which is addressed now in #293 without virtual selection.

@shouze
Copy link

shouze commented Dec 21, 2016

I have a question: will it be possible then to have an automatic copy of selection into pasteboard? (as it don't seems to work at least on macOS)

@parisk
Copy link
Contributor

parisk commented Dec 21, 2016

@shouze yep this can happen by utilising the hidden text area.

if you are having trouble right now with copying and pasting in xterm.js can you open a new issue please to track what is going wrong there?

@Tyriar
Copy link
Member Author

Tyriar commented Mar 8, 2017

@parisk I'll probably be able to pick this up in the next couple of months

@Tyriar
Copy link
Member Author

Tyriar commented Mar 31, 2017

Here's what I believe needs to happen for this:

  • Disable native web selection
  • Create selection model that's aware of the buffer and the way it continually trims itself (may be blocked on Buffer object introduced in Add logic for reflowing lines and preserving data when resizing #609)
  • Attach mouse events to selection model
    • Simple drag and drop in viewport
    • Drag beyond viewport
  • Visualize selection model on screen
  • Hook up copy and paste
  • Tests, tests, tests

Unknowns

  • How do we keep the selection themable by consumers how we do right now via ::selection?

@vincentwoo
Copy link
Contributor

I don't think you'll be able to maintain perfect backwards theming functionality (you'll probably need to theme a css class, like CodeMirror does), but I don't think that should be a blocker. If necessary, you can do a major version point upgrade. It should only be a minute's work to migrate a style.

@Tyriar
Copy link
Member Author

Tyriar commented Mar 31, 2017

Well the selection will likely be separate from the actual text, I'm thinking of just applying classes like the xterm-color-x ones to the selection as well. It would be a regression in VS Code is the main reason I'm after this, it's great for accessibility to invert the colors.

I don't think it would be worth a major version update to change this, I'm the only one doing it AFAIK.

@parisk
Copy link
Contributor

parisk commented Apr 4, 2017

@Tyriar since selection will have it's own DOM nodes, we can just use something like .xterm-selection for styling and also fall back to ::selection styling.

Last, there is no reason to issue a new major version for this, since we do not have an official, stable theming API yet.

@Tyriar
Copy link
Member Author

Tyriar commented Apr 4, 2017

@parisk web selection ::selection will be disabled completely as we will manage the selection model. But yes using classes that mirror the regular color classes should work fine.

Tyriar added a commit to Tyriar/xterm.js that referenced this issue May 21, 2017
This is part of the work to prepare for the upcoing selection changes

Related xtermjs#207
Tyriar added a commit to Tyriar/xterm.js that referenced this issue Jun 6, 2017
When zoomed in line-height and actual rendered row height differs. This
can be seen in the viewport being too large when zoomed in right now
but also has additional impacts in the new selection model xtermjs#207
@Tyriar Tyriar added this to the 2.8.0 milestone Jun 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement Features or improvements to existing features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants