Files icon indicating copy to clipboard operation
Files copied to clipboard

Fix: Fixed an issue where it didn't work to map certain keys to Actions

Open XTorLukas opened this issue 1 year ago • 5 comments

Resolved / Related Issues

To prevent extra work, all changes to the Files codebase must link to an approved issue marked as Ready to build. Please insert the issue number following the hashtag with the issue number that this Pull Request resolves.

  • #15403

Steps used to test these changes

Stability is a top priority for Files and all changes are required to go through testing before being merged into the repo. Please include a list of steps that you used to test this PR.

  1. Testing the correct mapping of all problem keys

XTorLukas avatar May 16 '24 21:05 XTorLukas

@yaira2 I found the cause of the NumKeys mapping not working, Not localized Pad0-9 image image

Now it's worked

image image

https://github.com/files-community/Files/assets/84145589/1b778795-94d9-4360-8291-2bc7a66856b2

XTorLukas avatar May 17 '24 14:05 XTorLukas

Oh, Decimal (NumPad) key not defined too

image

Feature

As I follow the definition of the Numpad keys at PowerToys is not bad as they define instead of "Decimal" --> ". (NumPad)"

Experimental Test

But I thought it would be enough to just localize the name 'NumPad' and the rest is default for all standards, at the same time it would be easier to know that the key is from 'NumPad' image

https://github.com/files-community/Files/assets/84145589/71e3edab-8fe3-450d-af73-48a22030b198

What do you think about that?

XTorLukas avatar May 17 '24 15:05 XTorLukas

Test own layout (cs-CZ_QWERTZ)

Qwertz_cz svg (2)

  • All Green lines are correct
  • Orange lines unused
  • Red Box (Caps Lock / Scroll Lock / Num Lock) would be good to disable in the selection, because they are not possible, but they are marked as Empty string and so can be overlooked. After saving the application fails.

XTorLukas avatar May 17 '24 17:05 XTorLukas

Red Box (Caps Lock / Scroll Lock / Num Lock) would be good to disable in the selection, because they are not possible, but they are marked as Empty string and so can be overlooked. After saving the application fails.

Now ignored non-valid keys aka Red Box and more optimalization for speed

  1. I added information about invalid key binding to give the user the option to use a different key binding. image

  2. Works also for already defined key bindings image

  3. I reworked the logic when the SaveButton and AddButton buttons are active

XTorLukas avatar May 17 '24 21:05 XTorLukas

Let's get to testing

  • Testing functionality across different locations
    • [x] cs-CZ
    • [x] sk-SK
    • [x] en-US
    • [x] ru-RU
    • [x] uk-UA
    • [ ] ... more
  • [x] Verification and search for possible bugs
  • [x] Finalization

XTorLukas avatar May 19 '24 16:05 XTorLukas

Code Quality is over A+. Looks great to me.

Thank you, I'm glad I'm not a useless liability here even though I've only been in this community for a short time. I'll definitely keep trying to improve the quality of the code.

XTorLukas avatar May 23 '24 17:05 XTorLukas

I just have an idea for the future, it would be good to merge all the work with "Key binding" into one class and split it into functions, at least now it's too much for one method https://github.com/files-community/Files/blob/d015e048c50baf19fa95f537aa3913c49bc4beee/src/Files.App/Views/Settings/ActionsPage.xaml.cs#L54-L143

XTorLukas avatar May 23 '24 17:05 XTorLukas

Definitely. We might want to use MS.Windows.Interactivity, MS.Window.Interaction.Core and ViewModel.HandleEditorInputCommand or just call ViewModel.HandleEditorInput();

0x5bfa avatar May 23 '24 17:05 0x5bfa

Sounds good.

XTorLukas avatar May 23 '24 18:05 XTorLukas

Will this have any effect on existing users?

yaira2 avatar May 24 '24 01:05 yaira2

Will this have any effect on existing users?

It won't be, I just fixed the correct display of mapped keys and added an informative teaching tip about invalid key binding

XTorLukas avatar May 24 '24 08:05 XTorLukas