-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Select text across widgets #3816
Comments
@emilk this is amazing, I have a lot of I figured that since you're actively working on this you might wanna tackle this inconsistency with the cursor to bring it closer to how the browser does it. Screen.Recording.2024-01-14.at.12.56.07.PM.movBasically, the cursor should become |
@juancampa if you want that, make a PR. I'll likely won't be working on this for at least another few weeks, if then. |
* Closes #3816 ![cross-widget-text-selection](https://github.com/emilk/egui/assets/1148717/5582b9d2-8b04-47b7-9637-f48e44064a70) Turn off with `style.interaction.multi_widget_text_select`. There is an API for this in `LabelSelectionState`, but it's pretty bare-bones. This became really hairy implementation-wise, but it works decently well. # Limitations * Drag-select to scroll doesn't work * A selection disappears if you scroll past one of its end-points * Only the text of labels and links are selectable ## TODO * [x] An option to turn it off * [x] An API for querying about the selected text, and to deselect it. * [x] Scrolling past selection behaves weird * [x] Shift-click to select a range
Awesome! Seems like this was indeed fixed in this PR 🥳 |
Since #3814 we can now select text within a single Label. However, if you put several widgets in a layout, you cannot select all the text across them at once. This gif showcases this shortcoming, here mixing
Label
withHyperlink
:In order to support this we need to keep track of the first and last widget of the selection. During layout, egui needs to track wether or not we are hitting one of these "edge" widgets, and then automatically mark all widgets in between as selected.
When hitting the "copy" button, the text of all widgets needs to be copied.
We should probably only allow drag-to-select a range within the same layer (i.e. Window/Area).
Copying text
When hitting
Cmd C
, each fully or partially selected widget needs to append their text to the clipboard, and probably insert an extra space between (unless there already is one).Handling this in the general case of right-to-left layouts will be difficult, so let's start with simple left-to-rigth/top-down layouts first.
The text was updated successfully, but these errors were encountered: