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

Trim search inputs #20825

Merged
merged 1 commit into from
May 22, 2024
Merged

Trim search inputs #20825

merged 1 commit into from
May 22, 2024

Conversation

silamon
Copy link
Contributor

@silamon silamon commented May 19, 2024

Proposed change

Trim leading and trailing whitespaces (also includes newlines and tabs)
See #20814 and #13783 for more information.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

Additional information

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

@steverep
Copy link
Member

I think this is okay, but I wonder if we should make sure to trim other pickers as well (e.g. area, device, etc.). We would need to make sure the user cannot set an area or other name with leading or trailing white space in the first place, otherwise it'd be a breaking change without a core change to trim everything.

@piitaya
Copy link
Member

piitaya commented May 22, 2024

It can be useful to search with leading space some time, but I agree, it's not really a common use case (But I sometime use it 😅) so for me it's not a bug fixes but a behavior change and I'm ok with that one.
I think in general we should improve our search (for example, searching for "camera" will not match "caméra" in french)

Searching for "porte"

CleanShot 2024-05-22 at 10 31 59

Searching for " porte"

CleanShot 2024-05-22 at 10 32 03

@piitaya piitaya merged commit 2113cf5 into home-assistant:dev May 22, 2024
14 checks passed
@karwosts karwosts mentioned this pull request May 26, 2024
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants