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

KeyCommand.DELETE_PREV_CHAR correctly deletes chars #1869

Open
wants to merge 2 commits into
base: jb-main
Choose a base branch
from

Conversation

m-sasha
Copy link
Member

@m-sasha m-sasha commented Feb 24, 2025

Before, the command was deleting to the previous character break. Now, it will correctly delete a code point instead so that diacritic marks are removed off a glyph instead of deleting the entire glyph. An exception is carved out for emojis, where the entire emoji will be deleted instead of a single code point, which would decompose emojis to their parts if deleting a single
code point.

Note that this is a cherry-pick of https://android-review.googlesource.com/c/platform/frameworks/support/+/3501992 with adaptations for CMP.

Fixes https://youtrack.jetbrains.com/issue/CMP-7478

Testing

  • Added new tests
  • Manual testing

This should be tested by QA

Release Notes

Fixes - Multiple Platforms

  • Changes pressing backspace in a textfield to delete diacritic marks, if any, rather than the entire character.

@m-sasha m-sasha requested a review from igordmn February 24, 2025 15:42
@m-sasha m-sasha force-pushed the m-sasha/fix-backspace-on-combined-characters branch from 980d12b to 8053cb8 Compare February 24, 2025 19:13
Before, the command was deleting to the previous character break. Now, it will correctly delete a code point instead so that diacritic marks are removed off a glyph instead of deleting the entire glyph. An exception is carved out for emojis, where the entire emoji will be deleted instead of a single code point, which would decompose emojis to their parts if deleting a single code point.

Fixes: b/395659876
Test: textField_backspace_withDiacritic
Test: textField_backspace_withEmoji
Change-Id: I9600d97eb2641bd218c6d5143753b50aa8f1624a
@m-sasha m-sasha force-pushed the m-sasha/fix-backspace-on-combined-characters branch 3 times, most recently from a9fcc4a to 0cdf2e0 Compare February 25, 2025 15:50
@m-sasha
Copy link
Member Author

m-sasha commented Feb 26, 2025

@igordmn Need your decision here. Should I try to go through icu in skiko, or is this approach ok?

@@ -261,3 +262,12 @@ androidx {
description = "Higher level abstractions of the Compose UI primitives. This library is design system agnostic, providing the high-level building blocks for both application and design-system developers"
legacyDisableKotlinStrictApiMode = true
}

tasks.register("updateEmojiValues", UpdateEmojiValuesTask.class) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suggest to create a task updateInternalization that depends on updateEmojiValues and updateTranslations, and describe it in MULTIPLATFORM.md.

Even if these tasks are needed to be called:

  • after updating Unicode version
  • after merging Jetpack Material or after adding a language

It is better to have one task that we call every merge, every unicode version update, etc. It makes life simpler (with an option of calling these tasks separately if needed)

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea, but maybe not "Internationalization" as it's not really about that.
Maybe "runAllUpdateTasks"?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would exclude run and task as it usually implied when we use Gradle.

Maybe updateGeneratedCode? And have:

  • updateGeneratedEmoji
  • updateGeneratedTranslations

Copy link
Member Author

Choose a reason for hiding this comment

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

updateGeneratedCode is better, but what if we have more tasks like these (in the sense that we need to run them whenever we do something, e.g. merge), but they don't actually generate code?

Copy link
Collaborator

Choose a reason for hiding this comment

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

but they don't actually generate code?

besides code generation I can only think about these tasks we might need to run after a merge:

  • run tests
  • check/dump API

I probably wouldn't unite them with code generation.

Copy link
Collaborator

Choose a reason for hiding this comment

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

not relevant with ICU

@m-sasha m-sasha force-pushed the m-sasha/fix-backspace-on-combined-characters branch from 0cdf2e0 to 9beefe7 Compare February 27, 2025 19:29
@m-sasha
Copy link
Member Author

m-sasha commented Feb 27, 2025

@igordmn @MatkovIvan I've reimplemented it via ICUs u_hasBinaryProperty. I have a bit less confidence in this implementation, but it seems to work.

Note that it depends on JetBrains/skiko#1029, so it will fail tests until we release skiko with that change.

@igordmn
Copy link
Collaborator

igordmn commented Feb 28, 2025

Please, update Skiko in a separate PR as here (it makes CI checks and the release notes easier)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants