Document type dialog filtering: Exact match and prefix matches should be preferred
System information
Arch Linux, Linux my-system 6.5.4-arch2-1 #1 SMP PREEMPT_DYNAMIC Thu, 21 Sep 2023 11:06:39 +0000 x86_64 GNU/Linux
Package version gnome-text-editor-44.0-2
Text Editor (44.0)
GLib: 2.78.0 (2.76.3)
GTK: 4.12.2 (4.10.4)
GtkSourceView: 5.8.0 (5.8.0)
Libadwaita: 1.4.0 (1.3.3)
Enchant2: 2.5.0
gtk-theme-name: Adwaita-empty
GTK_THEME: unset
GdkDisplay: GdkWaylandDisplay
Documents Directory: /home/defaultuser/Documents
org.gnome.TextEditor restore-session = false [default=true]
org.gnome.TextEditor recolor-window = true
org.gnome.TextEditor show-map = false
org.gnome.TextEditor custom-font = 'Monospace 11'
org.gnome.TextEditor show-line-numbers = true [default=false]
org.gnome.TextEditor style-scheme = 'Adwaita-dark' [default='Adwaita']
org.gnome.TextEditor wrap-text = false [default=true]
org.gnome.TextEditor style-variant = 'follow'
org.gnome.TextEditor indent-style = 'tab'
org.gnome.TextEditor show-right-margin = true [default=false]
org.gnome.TextEditor spellcheck = false [default=true]
org.gnome.TextEditor auto-indent = true
org.gnome.TextEditor use-system-font = true
org.gnome.TextEditor keybindings = 'default'
org.gnome.TextEditor highlight-current-line = true [default=false]
org.gnome.TextEditor last-save-directory = 'file:///home/my-user/Documents' [default='']
org.gnome.TextEditor auto-save-delay = uint32 3
org.gnome.TextEditor discover-settings = true
org.gnome.TextEditor enable-snippets = false
org.gnome.TextEditor line-height = 1.2
org.gnome.TextEditor indent-width = -1
org.gnome.TextEditor show-grid = false
org.gnome.TextEditor draw-spaces = @as []
org.gnome.TextEditor right-margin-position = uint32 80
org.gnome.TextEditor tab-width = uint32 4 [default=uint32 8]
Nightly not tested, would require investing more time to figure out how than I am currently willing to spend on this issue.
Bug information
Steps to reproduce
- Open Text Editor
- Open the "Document type" dialog
- Enter e.g. "sh" because you wish to use the "sh" document type
Current behaviour
The list of available document types is filtered to only contain those document types whose name contains "sh".
However, the desired "sh" document type is not the one at the top of this list, instead it is the 7th entry, requiring the user to navigate to this entry with multiple further key presses or with use of a pointing device.
If the user just types "sh" followed by Enter, the wrong document type "C#" gets selected, which can be argued to be rather unexpected.
Screenshots:
After typing the filter string "sh":
After pressing Enter:
Expected behaviour
The document type "sh" is the first result in the filtered list, because it is an exact match, and can be chosen by just pressing Enter.
Possibly the filter results should be grouped by priority as such:
- Exact match
- Prefix matches
- Other substring matches
The fact that the filtered list for "sh" also contains "F#" leads to the assumption that not just the user-visible string is considered but also a user-invisible descriptive text, in this case presumably "F Sharp".
This has merit and should continue to be that way; possibly any match by the descriptive string should be roped into the 3rd priority group.