Skip to content

Support block delete with word and line modifiers - #79695

Merged
justinmc merged 18 commits into
flutter:masterfrom
canastro:fix-block-delete-v2
Apr 7, 2021
Merged

justinmc merged 18 commits into
flutter:masterfrom
canastro:fix-block-delete-v2

Conversation

@canastro

@canastro canastro commented Apr 3, 2021

Copy link
Copy Markdown
Contributor

This PR focuses on supporting modifiers to delete blocks of text in a editable widget.

Shortcuts per OS

  • macOS
    • CMD (⌘) + Backspace: Delete all words left to the cursor
    • Option + Backspace: Delete word left to the cursor
  • Non macOS
    • Alt + Backspace: Delete all words left to the cursor
    • Ctrl + Backspace: Delete word left to the cursor

Some cases for reference:

case: 'text with| multiple words'
word modifier + backspace: 'text | multiple words'
line modifier + backspace: '| multiple words'
word modifier + delete: 'text with| words'
line modifier + delete: 'text with|'

case: 'text with multiple\n|words'
word modifier + backspace: 'text with |words'
line modifier + backspace: 'text with multiple\n|words'
word modifier + delete: 'text with multiple\n|'
line modifier + delete: 'text with multiple\n|'

case: 'text with multiple|\nwords'
word modifier + backspace: 'text with |\nwords'
line modifier + backspace: '|\nwords'
word modifier + delete: 'text with multiple|'
line modifier + delete: 'text with multiple|\nwords'

case: 'text with\n|\nmultiple words' in obscure text
word modifier + backspace: '|\nmultiple words'
line modifier + backspace: '|\nmultiple words'
word modifier + delete: 'text with\n|'
line modifier + delete: 'text with\n|'

case: 用多個塊測試 (cursor at offset 4)
backspace: '用多個測試' (cursor at offset 3)
word modifier + backspace: '用多個測試' (cursor at offset 3)
line modifier + backspace: '測試' (cursor at offset 0)
word modifier + delete: '用多個塊試' (cursor at offset 4)
line modifier + delete: '用多個塊' (cursor at offset 4)

case: برنامج أهلا بالعالم (cursor at offset 4 - from the right)
backspace: برنمج أهلا بالعالم (cursor at offset 3 - from the right)
word modifier + backspace: مج أهلا بالعالم (cursor at offset 0 - from the right)
word modifier + delete: برنا أهلا بالعالم (cursor at offset 4 - from the right)

Related issue:

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 feature I am adding, or Hixie said the PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard flutter-dashboard Bot added the framework flutter/packages/flutter repository. See also f: labels. label Apr 3, 2021
@google-cla google-cla Bot added the cla: yes label Apr 3, 2021
@canastro

canastro commented Apr 3, 2021 •

Copy link
Copy Markdown
Contributor Author

@LongCatIsLooong

This PR aims to fix the issue that was introduced on #77172

Here is the commit that fixes: b1d14c2
This was probably a test that was updated between my last rebase and the PR being merged.

Sorry for the inconvenient.

@justinmc justinmc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Ok looks like it was just a test added that used the keyboard. Easy fix.

@justinmc

justinmc commented Apr 5, 2021

Copy link
Copy Markdown
Contributor

Google testing wasn't working for me so I've just set it to green. I think we should be ok.

@fluttergithubbot

Copy link
Copy Markdown
Contributor

This pull request is not suitable for automatic merging in its current state.

  • The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label.

@justinmc

justinmc commented Apr 5, 2021

Copy link
Copy Markdown
Contributor

I'm holding off on merging this because of a crash reported in RenderEditable. It's not caused by this PR, but I don't want to complicate things. Will merge when that's resolved.

@justinmc

justinmc commented Apr 7, 2021

Copy link
Copy Markdown
Contributor

Everything is clear with the other bug so I'm merging this!

@justinmc
justinmc merged commit 0ba2f6a into flutter:master Apr 7, 2021
@justinmc

justinmc commented Apr 7, 2021

Copy link
Copy Markdown
Contributor

Thanks for all of your work on this @canastro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Delete by word does not work [macOS] Textfields should support CMD (⌘) + Backspace and Control + Backspace

3 participants