8000 Split ReadLineFromConsole() method by platforms by iSazonov · Pull Request #9222 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content

Split ReadLineFromConsole() method by platforms#9222

Closed
iSazonov wants to merge 0 commit intoPowerShell:masterfrom
iSazonov:master
Closed

Split ReadLineFromConsole() method by platforms#9222
iSazonov wants to merge 0 commit intoPowerShell:masterfrom
iSazonov:master

Conversation

@iSazonov
Copy link
Collaborator
@iSazonov iSazonov commented Mar 25, 2019

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

@iSazonov iSazonov added the CL-CodeCleanup Indicates that a PR should be marked as a Code Cleanup change in the Change Log label Mar 25, 2019
@iSazonov iSazonov added this to the 6.3.0-preview.1 milestone Mar 25, 2019
@iSazonov iSazonov requested a review from anmenaga as a code owner March 25, 2019 13:27
Copy link
Collaborator
@vexx32 vexx32 left a comment

Choose a reason for hiding this comment

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

Looks a lot cleaner! Maybe a couple things we could do better here as well. 😄

if (calledFromPipeline)
{
// make sure that the pipeline that called us is stopped

Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't think this blank line is needed here? :)

Suggested change

// 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)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is a HasFlag() appropriate here? Should this be a [Flags()] enum to make working with it easier?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is not clear in which direction we will move on, if we will.

restOfLine += s[i];
}

s = s.Remove(i);
Copy link
Collaborator

Choose a reason for hiding this comment

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

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)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm used to it. :-)

@iSazonov iSazonov force-pushed the master branch 3 times, most recently from 5351dd8 to e0bd410 Compare March 29, 2019 18:27
@iSazonov iSazonov closed this Mar 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-CodeCleanup Indicates that a PR should be marked as a Code Cleanup change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0