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

Update clipboard status on cut #92167

Merged
merged 1 commit into from Nov 1, 2021
Merged

Update clipboard status on cut #92167

merged 1 commit into from Nov 1, 2021

Conversation

Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
@tgucio
Copy link
Contributor

@tgucio tgucio commented Oct 20, 2021

This PR adds the call to clipboardStatus?.update() in TextSelectionControls 's handleCut() for consistency with handleCopy(). Currently this doesn't appear to cause issues as ClipboardStatusNotifier.update() is called from many other places (e.g. on EditableTextState.didUpdateWidget().

Tests

I added the following tests:

  group('TextSelectionControls', () {
    test('ClipboardStatusNotifier is updated on handleCut', () async {
    test('ClipboardStatusNotifier is updated on handleCopy', () async {

Relevant tests passing:

% ../../bin/flutter test test/cupertino/text_selection_test.dart
00:06 +13: All tests passed!                                                                                                                            
% ../../bin/flutter test test/cupertino/text_selection_toolbar_button_test.dart
00:03 +2: All tests passed!                                                                                                                             
% ../../bin/flutter test test/cupertino/text_selection_toolbar_test.dart
00:05 +3: All tests passed!                                                                                                                             
% ../../bin/flutter test test/material/text_field_test.dart
00:34 +325: All tests passed!                                                                                                                           
% ../../bin/flutter test test/material/text_selection_test.dart
00:06 +13: All tests passed!                                                                                                                            
% ../../bin/flutter test test/material/text_selection_toolbar_test.dart
00:05 +3: All tests passed!                                                                                                                             
% ../../bin/flutter test test/material/text_selection_toolbar_text_button_test.dart
00:04 +1: All tests passed!                                                                                                                             
% ../../bin/flutter test test/rendering/editable_test.dart
00:04 +39: All tests passed!                                                                                                                            
% ../../bin/flutter test test/widgets/editable_text_test.dart
00:18 +209: All tests passed!                                                                                                                           
% ../../bin/flutter test test/widgets/selectable_text_test.dart
00:18 +158 ~2: All tests passed!                                                                                                                        
% ../../bin/flutter test test/widgets/text_selection_test.dart 
00:05 +27: All tests passed!                                                                                                                            

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • All existing and new tests are passing.
Copy link
Contributor

@justinmc justinmc left a comment

LGTM 👍

I guess I say sure, let's do it. We probably shouldn't rely on incidental things to call update on the clipboard status. This makes it explicit. The code and tests look good.

Thanks for putting in the work to fix this when you noticed it.

Copy link
Contributor

@darrenaustin darrenaustin left a comment

I am not that familiar with the clipboard, but this LGTM. If we are updating the status manually in other cases it seems appropriate to do it for the cut action.

@justinmc justinmc merged commit 33e261c into flutter:master Nov 1, 2021
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment