Since we can no longer use ::selection
this is no longer possible as it is with the current version of VS Code.
There are a couple of challenges when approaching this problem:
One idea:
.xterm-rows
can be marked with xterm-invert-selection
class which invert background and foreground colors via CSS.z-index: 1
and the actual content of the row is added to the selection. aria-hidden
can then be added for good measure to ensure it's not read out twice.Not sure if it's the right solution though, I don't really like the duplication of text in the above solution but at least it's just on 2 rows.
@Tyriar Giving this some thoughts, I'm afraid your idea above won't work once we ship the true-color support. I'm afraid we have to split background / selection / foreground into separate layers, and then manipulate the foreground and background cols that are within the selection. I'll have a go at splitting it into layers once we have truecolor merged.
This is more of a nice to have, I don't think we would want to compromise performance/architecture or anything to make this possible. https://github.com/sourcelair/xterm.js/issues/720 is much more important imo.
I have no time for a PR right now, but I discovered that we may use the css mix-blend-mode
property to get this done with the renderer with very low effort:
.xterm-selection-layer {
mix-blend-mode: exclusion;
}
Additionally, even with a non-opaque selection color, this will make the foreground, selection and background visible:
.xterm-selection-layer {
mix-blend-mode: multiply;
}
Unfortunately, it doesn't seem to be supported by Edge atm.
Closing as this is much more complex than it would initially seem to do right and not one has voted for it. Plus it would be yet another option.
Most helpful comment
I have no time for a PR right now, but I discovered that we may use the css
mix-blend-mode
property to get this done with the renderer with very low effort:Additionally, even with a non-opaque selection color, this will make the foreground, selection and background visible:
Unfortunately, it doesn't seem to be supported by Edge atm.