Split ReadLineFromConsole() method by platforms#9222
Closed
iSazonov wants to merge 0 commit intoPowerShell:masterfrom
Closed
Split ReadLineFromConsole() method by platforms#9222iSazonov wants to merge 0 commit intoPowerShell:masterfrom
iSazonov wants to merge 0 commit intoPowerShell:masterfrom
Conversation
vexx32
reviewed
Mar 25, 2019
Collaborator
There was a problem hiding this comment.
Looks a lot cleaner! Maybe a couple things we could do better here as well. 😄
src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs
Outdated
Show resolved
Hide resolved
| if (calledFromPipeline) | ||
| { | ||
| // make sure that the pipeline that called us is stopped | ||
|
|
Collaborator
There was a problem hiding this comment.
Don't think this blank line is needed here? :)
Suggested change
src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs
Outdated
Show resolved
Hide resolved
| // then the tab we found is the completion character. bit 0x10 is set if the shift key was down | ||
| // when the key was hit. | ||
|
|
||
| if ((keyState & 0x10) == 0) |
Collaborator
There was a problem hiding this comment.
Is a HasFlag() appropriate here? Should this be a [Flags()] enum to make working with it easier?
Collaborator
Author
There was a problem hiding this comment.
It is not clear in which direction we will move on, if we will.
| restOfLine += s[i]; | ||
| } | ||
|
|
||
| s = s.Remove(i); |
Collaborator
There was a problem hiding this comment.
After reading this method, it seems like it would be a lot clearer if we renamed the s variable to something like inputString (probably in the other one as well)
Collaborator
Author
There was a problem hiding this comment.
I'm used to it. :-)
5351dd8 to
e0bd410
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PR Summary
Make ReadLineFromConsole() methods for Windows and Unix platforms.
PR Context
ReadLineFromConsole() method has many
#if-s and it is very difficult to read and maintain code of the method.Come from #9165.
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.[feature]to your commit messages if the change is significant or affects feature tests