elementary / applications-menu

Applications Menu for elementary OS and the Pantheon desktop environment
https://elementary.io
GNU General Public License v3.0
104 stars 36 forks source link

Irrelevant results with all-caps search #474

Closed candiedoperation closed 2 years ago

candiedoperation commented 3 years ago

What Happened

Search results are irrelevant in Wingpanel when search text is in uppercase. (Example: Text: 99999)

Expected Behavior

Search with uppercase should return same results as the ones with lowercase

Steps to Reproduce

  1. Open Applications Menu (⌘ + Space)
  2. Type something in uppercase
  3. Calculator ranks as the top match

https://user-images.githubusercontent.com/47198395/117439438-762f7c00-af50-11eb-9e94-c8694e75e6cf.mp4

Logs

No Logs

Platform Information

Operating System: elementary OS 6 Edition: (Public Beta) Hardware Information:

Laptop Information: HP Pavilion x360

jeremypw commented 2 years ago

This not actually unexpected for bc - the underlying program used to process the input. man bc includes the following information:

Input numbers may contain the characters 0–9 and A–Z. (Note: They must be capitals. Lower case letters are variable names.) Single digit numbers always have the value of the digit regardless of the value of ibase. (i.e. A = 10.) For multi-digit numbers, bc changes all input digits greater or equal to ibase to the value of ibase-1. This makes the number ZZZ always be the largest 3 digit number of the input base.

However, we probably do not want this behaviour in applications-menu - we only need cater for single simple expressions, not use the full power of bc.

A very simple fix is to convert the input to lower case before submitting to bc. A better fix may be to change the regex as some expressions like pi and e, which bc recognizes could be useful to accept.