mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #23738 - mmiecz:clipboard-cut, r=jdm
Add clipboard cut functionality <!-- Please describe your changes on the following line: --> This PR adds clipboard cut functionality. #23735 --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #23735 (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because manually testing whether cutting works is enough. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23738) <!-- Reviewable:end -->
This commit is contained in:
commit
67d38b429b
1 changed files with 7 additions and 0 deletions
|
@ -877,6 +877,13 @@ impl<T: ClipboardProvider> TextInput<T> {
|
|||
self.select_all();
|
||||
KeyReaction::RedrawSelection
|
||||
})
|
||||
.shortcut(CMD_OR_CONTROL, 'X', || {
|
||||
if let Some(text) = self.get_selection_text() {
|
||||
self.clipboard_provider.set_clipboard_contents(text);
|
||||
self.delete_char(Direction::Backward);
|
||||
}
|
||||
KeyReaction::DispatchInput
|
||||
})
|
||||
.shortcut(CMD_OR_CONTROL, 'C', || {
|
||||
if let Some(text) = self.get_selection_text() {
|
||||
self.clipboard_provider.set_clipboard_contents(text);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue