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

Fixes #3095. WindowsDriver should return the mask keys to IsShift, IsAlt and IsCtrl return the right value. #3096

Closed

Conversation

BDisp
Copy link
Collaborator

@BDisp BDisp commented Dec 28, 2023

Fixes #3095 - The drivers should use the mask keys before create a Key object.

Pull Request checklist:

  • I've named my PR in the form of "Fixes #issue. Terse description."
  • My code follows the style guidelines of Terminal.Gui - if you use Visual Studio, hit CTRL-K-D to automatically reformat your files before committing.
  • My code follows the Terminal.Gui library design guidelines
  • I ran dotnet test before commit
  • I have made corresponding changes to the API documentation (using /// style comments)
  • My changes generate no new warnings
  • I have checked my code and corrected any poor grammar or misspellings
  • I conducted basic QA to assure all features are working

…ft, IsAlt and IsCtrl return the right value.
@BDisp BDisp requested a review from tig as a code owner December 28, 2023 15:45
@tig
Copy link
Collaborator

tig commented Dec 28, 2023

If the user just presses and releases a shift key it should be registered as just that key.

This change breaks this.

@BDisp
Copy link
Collaborator Author

BDisp commented Dec 28, 2023

If the user just presses and releases a shift key it should be registered as just that key.

This change breaks this.

A shift key pressed or released is always a shift key. If you check the wVirtualKeyCode is the same at key down and key up. I don't understand what it is breaking (16).

Captura de ecrã 2023-12-28 161548

Captura de ecrã 2023-12-28 161657

@BDisp
Copy link
Collaborator Author

BDisp commented Dec 28, 2023

If you are meaning that must returns as 16 the IsShift never return true. I think you are misunderstood something here.

@tig
Copy link
Collaborator

tig commented Dec 28, 2023

Run the Key scenario. Press ctrl and release it.

@BDisp
Copy link
Collaborator Author

BDisp commented Dec 28, 2023

The issue is because the Key class is removing the KeyCode.ShiftMask on all situations. The only situation where it must remove the KeyCode.ShiftMask, if it's the only modifier key used, is when it's handling a printable character where only the character must be passed. For e.g. TextView cannot handle KeyCode.A | KeyCode.ShiftKey and thus it only needed the KeyCode.A. So the solution is if only the modifiers keys are pressed without another key then they must be handled in the Key class as KeyCode.ShiftMask, KeyCode.AltMask, KeyCode.CtrlMask or as KeyCode.ShiftKey, KeyCode.AltKey, KeyCode.CtrlKey.
I'll try to discover some solution for this.

@tig
Copy link
Collaborator

tig commented Dec 28, 2023

I think you're wrong but I cannot yet articulate why.

Please give me a few days to get a chance to dive in.

I'm traveling internationally next few days.

@BDisp
Copy link
Collaborator Author

BDisp commented Dec 28, 2023

I think you're wrong but I cannot yet articulate why.

Please give me a few days to get a chance to dive in.

I'm traveling internationally next few days.

No problem, sorry. I only will add my solution and you only accept it after you have time and if you agree with it, of course.

@BDisp
Copy link
Collaborator Author

BDisp commented Dec 28, 2023

It's working now. Modifiers keys must be valid for key down and key up.

VsDebugConsole_2gyivcJOJ1.mp4

@tig
Copy link
Collaborator

tig commented Jan 4, 2024

Closing this as it's addressed in your other pr.

@tig tig closed this Jan 4, 2024
@BDisp BDisp deleted the v2_wndowsdrver-shift-alt-ctrl-fix_3095 branch January 4, 2024 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants