Skip to content

Adding auto-UI shortcuts to menu based on keymappings#924

Merged
zadjii-msft merged 16 commits intomicrosoft:masterfrom
timheuer:shortcuts
May 22, 2019
Merged

Adding auto-UI shortcuts to menu based on keymappings#924
zadjii-msft merged 16 commits intomicrosoft:masterfrom
timheuer:shortcuts

Conversation

@timheuer
Copy link
Member

Summary of the Pull Request

This modifies the UI menu to display the shortcuts for those options based on the new keybinding mappings from #748.

References

Enhances #748 to respond to custom keybinding mappings

PR Checklist

  • Closes Surface keyboard shortcuts in Menu when shown #791
  • CLA signed. If not, go over here and sign the CLA
  • Tests added/passed
  • Requires documentation to be updated
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

Detailed Description of the Pull Request / Additional comments

  • Added a few static methods to AppKeyBindings to find a keybinding from the loaded map and create a keyboard UI shortcut for it.
  • Two static helpers exist to map Terminal KeyChord values to WinRT VirtualKey and VirtualKeyModifiers. These should be removed/not needed once KeyChord should just use the existing WinRT types instead of defining our own #877 is decided on (assuming it would go to WinRT APIs).
  • Special casing the comma character due to a bug in the XAML UI framework that is not yet resolved and on backlog for WinUI 3.0 roadmap (noted in comments)

@DHowett-MSFT
Copy link
Contributor

Hey @timheuer,
Thanks for the contribution!
Would you mind sharing a screenshot? This is exciting!

@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label May 21, 2019
@timheuer
Copy link
Member Author

image
Sure thing here you go. These are all generated from the keybindings in profiles.json.

@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label May 21, 2019
Copy link
Contributor

@DHowett-MSFT DHowett-MSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm comfortable with this, and it's really cool too

Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really cool, great work

@zadjii-msft
Copy link
Member

/azp run

1 similar comment
@DHowett-MSFT
Copy link
Contributor

/azp run

@zadjii-msft
Copy link
Member

@miniksa do you know why this test keeps failing?
https://dev.azure.com/ms/Terminal/_build/results?buildId=16264


Passed   BasicWriteConsoleOutputATest
Win32BoolSucceeded(SetConsoleWindowInfo(consoleOutputHandle, true, &window)) - Value (6)
Failed   WriteConsoleOutputWOutsideBuffer
Error Message:
 Win32BoolSucceeded(SetConsoleWindowInfo(consoleOutputHandle, true, &window)) - Value (6)
Stack Trace:
at OutputTests::WriteConsoleOutputWOutsideBuffer() in d:\a\1\s\src\host\ft_host\api_outputtests.cpp:line 140
Standard Output Messages:
 Win32BoolSucceeded(CloseHandle(_hConsole)): Removing our test screen buffer.
 Restoring v1/v2 console state to original '1'
 Win32BoolFailed(RegSetValueExW(_consoleKey.get(), pwszForceV2ValueName, 0, REG_DWORD, (LPBYTE)&_dwForceV2Original, sizeof(_dwForceV2Original)))
 AreEqual(ERROR_SUCCESS, lstatus)
 Backing up v1/v2 console state.
 Win32BoolFailed(lstatus): Assert querying ForceV2 key was successful.
 Setting v1/v2 console state to desired '1'
 Win32BoolFailed(RegSetValueExW(_consoleKey.get(), pwszForceV2ValueName, 0, REG_DWORD, (LPBYTE)&ForceV2StateDesired, sizeof(ForceV2StateDesired)))
 SUCCEEDED(RuntimeParameters::TryGetValue(L"TestDeploymentDir", value))
 SUCCEEDED(StringCchCopyW(str, cchNeeded, (WCHAR*)value.GetBuffer()))
 Win32BoolSucceeded(nullptr != hJob)
 Win32BoolSucceeded(SetInformationJobObject(hJob.get(), JobObjectExtendedLimitInformation, &JobLimits, sizeof(JobLimits)))
 Win32BoolSucceeded(CreateProcessW(nullptr, str, nullptr, nullptr, FALSE, CREATE_NEW_CONSOLE | CREATE_SUSPENDED, nullptr, nullptr, &si, pi.addressof()))
 Win32BoolSucceeded(AssignProcessToJobObject(hJob.get(), pi.hProcess))
 Win32BoolSucceeded(-1 != ResumeThread(pi.hThread))
 IsLessThan(dwTotalWait, _dwMaxMillisecondsToWaitOnStartup)
 IsNotNull(pPidList)
 Win32BoolSucceeded(QueryInformationJobObject(hJob.get(), JobObjectBasicProcessIdList, pPidList, cbRequired, nullptr))
 AreEqual(pids.NumberOfAssignedProcesses, pPidList->NumberOfProcessIdsInList)
 AreNotEqual(0u, dwFindPid)
 Win32BoolSucceeded(FreeConsole())
 Win32BoolSucceeded(AttachConsole(dwFindPid))
 AreEqual(0, err)
 AreEqual(0, err)
 AreNotEqual(_hConsole, INVALID_HANDLE_VALUE): Creating our test screen buffer.
 Win32BoolSucceeded(SetConsoleActiveScreenBuffer(_hConsole)): Applying test screen buffer to console
 ***********	WriteConsoleOutputWOutsideBuffer - Test Start		***********
 
 Win32BoolSucceeded(SetConsoleWindowInfo(consoleOutputHandle, true, &window)) - Value (6)
 
 ***********	WriteConsoleOutputWOutsideBuffer - Test End		***********
 ***********	WriteConsoleOutputWOutsideBuffer - Test Failed	***********

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@zadjii-msft zadjii-msft merged commit e9a3d16 into microsoft:master May 22, 2019
@miniksa
Copy link
Member

miniksa commented May 23, 2019

@zadjii-msft, no idea, file an issue.

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.

Surface keyboard shortcuts in Menu when shown

4 participants