-
Notifications
You must be signed in to change notification settings - Fork 237
Fix '@' appearing in console #1092
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why
ConsoleKey.DownArrow
instead ofConsoleKey.Spacebar
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't add any output to the buffer, and seemed to work without consequences when I tried it, which seems logical since inputting
DownArrow
in PSRL would do nothing if you're at the last prompt already.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: name the
' '
parameter.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it trigger custom key handlers? Assuming it does, is there some character we could send that isn't typically possible to receive as input that we could specifically handle on the PSRL side?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Valid values are here: https://docs.microsoft.com/en-us/dotnet/api/system.consolekey?view=netstandard-2.0
Could possibly use a numeric value that isn't in the enum, but that could be fragile.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some more options, we could do something similar to how I'm currently getting around lack of SHIFT + ENTER support (e.g. sending an emoji as raw input)
For instance, if you send
0x2665
to xterm directly as a raw text sequence it comes across as this:Note that 18 is
VK_MENU
aka ALT.Not 100% sure why it comes across that way, the raw input is just(Apparently it comes through as a ALT + NumPad unicode sequence).\u2665
.It is still possible to conflict with an existing key bind that way, but significantly less likely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does mean we'll need to create another contract with PSRL to throw this character out if it is seen. That makes me uneasy... Seems very hacky.
@daxian-dbw would you mind giving your point of view?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it really all that more hacky than sending a valid key that we hope no one uses? To be clear, I'm not saying it isn't hacky. Everything around our
ReadKey
is incredibly hacky and will continue to be until the dayReadKeyAsync
is properly implemented in corefx (a man can dream right?). This variant of hacky is a lot less likely to spawn other issues, definitely open to better ideas though.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other possibility I had was an unmodified Space. That one seems safe, but it does add a space to the console.
The only actual safe thing to do is to redefine our contract with PSRL so that we can say "we didn't get anything at all". Currently that
@
character represents PSRL not understanding the key press.Anyway, I'm not proposing that this change be permanent. Just something that works better for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah fair enough. Probably fine for preview.