-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Visual marker at end of the selection and selectionStyle option to Terminal #3274
Conversation
…ption to Terminal We introduce a new configuration option - selectionStyle - used to style the text selection layer. It has three 'modes': plain (the current default), 'mark-end' (add a marked to the end) and 'mark-start' (add a marker to the beginning). This is useful when integrating with applications that need to allow manipulating either end of the selection range via keyboard
Thats an interesting feature. When you write
Does that mean you have to move the cursor? Or how do you do that? If it involves cursor movements, how do you go about selections in the scrollback (not addressible by the cursor)? And how do you sync that with the application? Sorry for so many questions, maybe you could explain it and the actual use cases abit more in detail? |
hi @jerch, this is a feature we need for Terminal 7. Adam is a friend who loves TypeScript so his helping me with one of the key features we're missing for 1.0 - tmux style copy mode : tuzig/terminal7#66 . In the past I tried and failed in developing this feature. The cursor is stuck on the bottom page and that's the way xterm.js is. Adam had a great idea: to let the cursor be and use the selection start|end instead. This PR is just a part of the feature, the other being a copy-mode plugin to use this new option. Here is the code, it's still under works and part of terminal7 but not for long. |
I have a few concerns with this:
This is awfully similar to something I've wanted xterm.js to do for a while which is to just allow manipulating a cursor (not the actual cursor) within the buffer to enable:
You would enter such a mode somehow and then exit it via escape. So I'd be all in for getting that or something that works towards that in. I'd like to propose an alternative to this change, all you seem to need is to be able to mark the start and end of the selection, essentially allowing embedders/addons to add decorations to parts of the buffer which we have an open issue on: #1852 There's some discussion in that issue but my basic thinking would be to have an overlay element ( const s = term.getSelectionPosition();
const decoration = term.decorateRange({
x: s.startColumn,
y: s.endColumn
});
decoration.element.style.border = '1px solid #fff'; Some thought would need to be given to the exact shape of the API, but the big benefits here is that is aligns with our goals and it would end up being used by several embedders (including VS Code, eg microsoft/vscode#46561). |
Yes, implementing this as an add-on would have been my first preference - but modifying the style of the buffer seemed to be impossible with current API. I'll take a stab at implementing the decorations API (or a first draft of it, at least) |
@akariv I'd recommend approaching it in a similar way to how
|
Closing this as we've opted for another approach. |
We introduce a new configuration option -
selectionStyle
- used to style the text selection layer.It has three 'modes':
plain
(the current default),mark-end
(add a marker to the end) andmark-start
(add a marker to the beginning of the selection range). The styling of the marker is taken from the theme itself.The use case here is when integrating with applications that need to allow manipulating either end of the selection range via keyboard, and we need a way to show the user the currently 'selected' end.
mark-start:
mark-end: