Bug 500053 - When searching for keyboard layouts, exact matches may not be the first item in the list on the left
Summary: When searching for keyboard layouts, exact matches may not be the first item ...
Status: RESOLVED FIXED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_keyboard (show other bugs)
Version: 6.3.0
Platform: Debian unstable Linux
: NOR minor
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords: usability
Depends on:
Blocks:
 
Reported: 2025-02-14 10:41 UTC by John
Modified: 2025-03-03 21:38 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.4.0
Sentry Crash Report:


Attachments
Search results for Romanian language (195.98 KB, image/png)
2025-02-14 10:41 UTC, John
Details

Note You need to log in before you can comment on or make changes to this bug.
Description John 2025-02-14 10:41:15 UTC
Created attachment 178353 [details]
Search results for Romanian language

SUMMARY
Add Layout search gives results in the wrong order

STEPS TO REPRODUCE
1. Open System Settings.
2. Navigate to Keyboard.
3. Click on the Enable toggle to be able to add a few layouts.
4. Click on the + Add... button to add a new layout.
5. Search for 'Romanian', 'French', 'German', 'Spanish'.

OBSERVED RESULT
The items on the country / variant (right column) are more important than the items on the language (column).
So the language suggestions are in the left column are based on the items in the right column.
In my case with the Romanian language, where I noticed the problem, the first language suggestion should be Romanian.
If any country variant should be suggested then it should be Moldova, not Germany as Moldova is the only other country where Romanian is spoken and written:
https://en.wikipedia.org/wiki/Romanian_language#/media/File:Idioma_rumano.PNG
But with the laws they passed last year the Moldovan language should not be used anymore as it's just Romanian and they should call it Romania so I don't think it has a variant, but if they one day they say it does, then this is the only other country / variant that should be suggested for Romanian language.
Anyway I think the same problem exists for other languages too.


EXPECTED RESULT
Match languages first on the left column, so the the more exact / close that what has been typed the more higher up in the list.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma:
KDE Plasma Version: 6.3.0
KDE Frameworks Version: 6.10.0
Qt Version: 6.7.2
Kernel Version: 6.12.13-amd64 (64-bit)
Graphics Platform: Wayland


HARDWARE SPECIFICATIONS
Hardware: Laptop Dell Inspiron 5770 (17" 1080p@60Hz screen)
CPU: Intel® Core™ i5-8250U CPU @ 1.60GHz
GPU 1: Mesa Intel® UHD Graphics 620 (main)
GPU 2: AMD Radeon R5 M465 Series
RAM: 8 GiB (7.7 GiB usable)
Comment 1 Nate Graham 2025-02-19 15:08:34 UTC
From a technical perspective, this is correct since the lists are both ordered alphabetically.

However I see how it's not ideal in this specific use case. Perhaps we could prioritize exact matches in the left column.
Comment 2 John 2025-02-19 15:56:27 UTC
I agree that it's correct by search on both columns, but for my use case and usability in general I think that the language should be prioritized as the user searches for the languages mainly.
Then of course, if there are more variants / countries) maybe it wants to choose that, if the default is not the right one.

Honestly I'm not even sure why the right column is searched at all.
I can't think of a language right now that can be found on the right column and not on the left.
One other thing that could be done after the language is matched on the left column, would be to order the variants by country size in population to have more chances of suggesting the right one for the user.
Like:
English - > United States (first in the right column)
German -> Germany (first in the right column)
French -> France (first...)
Italian -> Italy (first...)
Romanian -> (Romanian standard, instead of Romanian, here as that's the one that most of us use and it has the right diacritics, but I think this needs a bug report with a bit more documentation on my side). 
It would be a bit weird for Spanish as Spain not being the first, but at least it will be the suggestion that most people wanted.

But anyway, that would probably take a lot of time to implement.
So, I at least, would be happy with prioritizing the left column.
Comment 3 Bug Janitor Service 2025-02-20 19:45:17 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/2840
Comment 4 Nate Graham 2025-03-03 21:38:22 UTC
Git commit bd50c79c4813b19aa8cbe2cf706de849430151f6 by Nate Graham, on behalf of Bharadwaj Raju.
Committed on 03/03/2025 at 21:38.
Pushed by ngraham into branch 'master'.

kcms/keyboard: implement fuzzy search for layouts

Implements scored fuzzy search for layouts using
KFuzzyMatcher.
FIXED-IN: 6.4.0

M  +1    -0    kcms/keyboard/CMakeLists.txt
M  +5    -5    kcms/keyboard/layoutmodel.h
A  +70   -0    kcms/keyboard/layoutsearchmodel.cpp     [License: GPL(v2.0+)]
A  +38   -0    kcms/keyboard/layoutsearchmodel.h     [License: GPL(v2.0+)]
M  +2    -0    kcms/keyboard/qml/plugin.cpp
M  +30   -27   kcms/keyboard/ui/LayoutDialog.qml

https://invent.kde.org/plasma/plasma-desktop/-/commit/bd50c79c4813b19aa8cbe2cf706de849430151f6