GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — MegaPatch that includes all of #717, plus RawUI fixes by palladia · Pull Request #730 · PowerShell/PowerShell

Conversation

@palladia

@palladia George Fleming (palladia) commented Mar 22, 2016

Copy link
Copy Markdown
Contributor

This change is Reviewable

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@palladia George Fleming (palladia) added the in progress label Mar 22, 2016
@palladia George Fleming (palladia) mentioned this pull request Mar 22, 2016
Ctrl Key mega patch that adds support for a number of Ctrl keys for command-line editing #717
Closed
@andyleejordan

Andy Jordan (andyleejordan) commented Mar 22, 2016

Copy link
Copy Markdown
Member

This is looking good to me. I want a change to build and test it out myself though as it's a lot of untestable new behavior.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@palladia George Fleming (palladia) added need review and removed in progress labels Mar 23, 2016
@palladia George Fleming (palladia) mentioned this pull request Mar 23, 2016
$Host.UI.RawUI.BackgroundColor should be customizable at runtime #298
Closed
@andyleejordan Andy Jordan (andyleejordan) mentioned this pull request Mar 23, 2016
$host.ui.rawui issues #714
Closed
@andyleejordan

Andy Jordan (andyleejordan) commented Mar 23, 2016

Copy link
Copy Markdown
Member

Tested:

  • Ctrl-C to kill single-line (doesn't yank, should it?)
  • Ctrl-C to exit multi-line
  • Ctrl-C is passed to running commands
  • Ctrl-K works, and is yankable with Ctrl-Y
  • Ctrl-Y can yank anywhere
  • Ctrl-L clears, and keeps current line (even in multi-line)
  • Ctrl-R reverse searches
  • Ctrl-R incrementally searches
  • Ctrl-R cycles backward through matches
  • Ctrl-R reports when there are no more matches to be found
  • Ctrl-R text does not match PSReadLine
  • Ctrl-S does not cycle forward through history search
  • $Host.UI.RawUI.BackgroundColor is customizable (MegaPatch that includes all of #717, plus RawUI fixes #730)
  • $Host.UI.RawUI.ForegroundColor is not customizable
  • Ctrl-Home does nothing, should it?
  • Ctrl-End does nothing, should it?
  • Ctrl-Home in PSReadLine on Windows moves to the top of the buffer
  • Ctrl-End in PSReadLine on Windows moves to the end of the buffer

Reviewed 4 of 4 files at r1.
Review status: all files reviewed at latest revision, 10 unresolved discussions.


src/Microsoft.PowerShell.Linux.Host/main.cs, line 576 [r1] (raw file):
Just some style notes:

  • We can (and should) prefer var over a type; let the compiler deduce it to make refactoring easy later
  • We should avoid this. as it is (almost) never necessary
  • string vs String should be consistent
  • We need to write some style documentation for all of PowerShell...

src/Microsoft.PowerShell.Linux.Host/main.cs, line 624 [r1] (raw file):
Is ToString() necessary? Shouldn't WriteLine, taking a string, implicitly do this? I don't know.


src/Microsoft.PowerShell.Linux.Host/readline.cs, line 87 [r1] (raw file):
Yay!


src/Microsoft.PowerShell.Linux.Host/readline.cs, line 165 [r1] (raw file):
Does anything from here possibly throw? If so, we should probably reset TreatControlCAsInput in a finally block.


src/Microsoft.PowerShell.Linux.Host/readline.cs, line 214 [r1] (raw file):
Should these refs maybe become private class members?


src/Microsoft.PowerShell.Linux.Host/readline.cs, line 615 [r1] (raw file):
Is there not a ui.Write(ForegroundColor, BackgroundColor, string)?


src/Microsoft.PowerShell.Linux.Host/readline.cs, line 617 [r1] (raw file):
PSReadLine calls this bck-i-search: and when typing, shows bck-i-search: foo_


src/Microsoft.PowerShell.Linux.Host/readline.cs, line 621 [r1] (raw file):
$"{searchResult}" is much preferred to String.Format (same with reverse-i-search)


src/Microsoft.PowerShell.Linux.Host/readline.cs, line 640 [r1] (raw file):
We should handle ConsoleKey.S to searchPos++. I'm fine with a new issue for this instead though. PSReadLine calls this fwd-i-search:.


src/Microsoft.PowerShell.Linux.Host/readline.cs, line 698 [r1] (raw file):
PSReadLine displays failed-bck-i-search:.


Comments from the review on Reviewable.io

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@andyleejordan

Andy Jordan (andyleejordan) commented Mar 23, 2016

Copy link
Copy Markdown
Member

Just saw this:

/home/andrew/src/PowerShell-Linux |-/ (reverse-i-search)'c': $Host.UI.RawUI.BackgroundColor = 'Black'                              (failed reverse-i-search)'co': $Host.UI.RawUI.BackgroundColor = 'Black'                      (failed reverse-i-search)'con': $Host.UI.RawUI.BackgroundColor = 'Black'                     (failed reverse-i-search)'cons': $Host.UI.RawUI.BackgroundColor = 'Black'                    (failed reverse-i-search)'conso': $Host.UI.RawUI.BackgroundColor = 'Black'                   (failed reverse-i-search)'consol': $Host.UI.RawUI.BackgroundColor = 'Black'                  (failed reverse-i-search)'console': $Host.UI.RawUI.BackgroundColor = 'Black'

Only it was wrapping at my Window border. Is it fixable?


Review status: all files reviewed at latest revision, 8 unresolved discussions.


Comments from the review on Reviewable.io

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@andyleejordan

Andy Jordan (andyleejordan) commented Mar 23, 2016

Copy link
Copy Markdown
Member

We also need to initialize $Host.UI.RawUI.BackgroundColor and $Host.UI.RawUI.ForegroundColor on start to solve the first issue in #714.


Review status: all files reviewed at latest revision, 8 unresolved discussions.


Comments from the review on Reviewable.io

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@palladia

George Fleming (palladia) commented Mar 23, 2016

Copy link
Copy Markdown
Contributor Author

To answer some of your concerns:

  1. Ctrl-R text. I took the text from bash, since it has a similar one-line behavior.
  2. Ctrl-S. I mentioned this at stand up, that it may not make sense to implement forward search. Everyone agreed.
  3. Foreground color is not customizable? Please elaborate. It seems to work for me.
  4. Ctrl-Home and Ctrl-End. I didn't see a requirement on this. It wasn't the intention to implement every key shortcut.
  5. Console colors default to -1 at startup. Once you override, the -1 goes away. If you have default value from profile, you also will not see -1.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@palladia

George Fleming (palladia) commented Mar 23, 2016

Copy link
Copy Markdown
Contributor Author

src/Microsoft.PowerShell.Linux.Host/main.cs, line 624 [r1] (raw file):
It was necessary because compiler complained that it could not convert from PSObject to String, if I remember correctly.


Comments from the review on Reviewable.io

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@andyleejordan

Andy Jordan (andyleejordan) commented Mar 23, 2016

Copy link
Copy Markdown
Member
  1. We're trying to emulate PSReadLine, not Bash
  2. Ctrl-S should be implemented since PSReadLine does so, but this can be done separately
  3. Oh; I expected it to change the color of the text in the prompt; it just changes cmdlet output color
  4. I don't mind them being unimplemented; it just looked like you had
  5. They appear to be set on Windows, so we should do the same

Review status: all files reviewed at latest revision, 7 unresolved discussions.


Comments from the review on Reviewable.io

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@palladia

George Fleming (palladia) commented Mar 23, 2016

Copy link
Copy Markdown
Contributor Author

Review status: all files reviewed at latest revision, 7 unresolved discussions.


src/Microsoft.PowerShell.Linux.Host/readline.cs, line 165 [r1] (raw file):
Nothing here is supposed to throw. And if something does throw, how should we handle it? Abort the input like ctrl-c? In theory, no valid command will get executed, so not changing TreatControlCAsInput to false would not be catastrophic .


src/Microsoft.PowerShell.Linux.Host/readline.cs, line 214 [r1] (raw file):
I could've implemented these bool's as class members. Not sure if it's worth changing though.


src/Microsoft.PowerShell.Linux.Host/readline.cs, line 615 [r1] (raw file):
Yes, I could use that. Wrote these before the migration to ui.write.


src/Microsoft.PowerShell.Linux.Host/readline.cs, line 617 [r1] (raw file):
Do we have to match PSReadline?


src/Microsoft.PowerShell.Linux.Host/readline.cs, line 621 [r1] (raw file):
"much preferred" because? Not sure it's a big difference, but I will change it.


src/Microsoft.PowerShell.Linux.Host/readline.cs, line 640 [r1] (raw file):
It's not clear where forward search starts at, and native Window PS basically does nothing. I brought this up at stand up, and it's agreed that the lack of definition of where "current line" is makes implementing this a difficult thing, and not worth the effort now.


src/Microsoft.PowerShell.Linux.Host/readline.cs, line 698 [r1] (raw file):
Again, do we have to match PSReadline? I chose this implementation because it's fairly simple, and can be done in one-line. I don't claim this is a full-featured implementation of reverse-search. In fact, PSReadLine's implementation does a lot more, especially when it comes to multi-line commands. I chose not to spend days to support multi-line recall right now.


Comments from the review on Reviewable.io

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@palladia

George Fleming (palladia) commented Mar 23, 2016

Copy link
Copy Markdown
Contributor Author

I don't care if we emulate PSReadLine, or Bash. Had I chosen PSReadLine, someone might say that we should emulate Bash. Is there a requirement that we should match PSReadLine exactly?


Review status: all files reviewed at latest revision, 7 unresolved discussions.


Comments from the review on Reviewable.io

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@andyleejordan

Andy Jordan (andyleejordan) commented Mar 23, 2016

Copy link
Copy Markdown
Member

Yes, we are trying to emulate PSReadLine as close as reasonably possible.


Review status: all files reviewed at latest revision, 5 unresolved discussions.


src/Microsoft.PowerShell.Linux.Host/readline.cs, line 615 [r1] (raw file):
We probably should so it's consistent.


src/Microsoft.PowerShell.Linux.Host/readline.cs, line 617 [r1] (raw file):
Yes, that's the goal.


src/Microsoft.PowerShell.Linux.Host/readline.cs, line 621 [r1] (raw file):
Yes, much preferred. It's both more maintainable and significantly faster, as it allows the compiler to string smash.


src/Microsoft.PowerShell.Linux.Host/readline.cs, line 640 [r1] (raw file):
Forward search starts where backward search left off, literally just reverse direction from current result. If no reverse search was done, it is a no-op.


src/Microsoft.PowerShell.Linux.Host/readline.cs, line 698 [r1] (raw file):
That's fine, but I think thr text should match.


Comments from the review on Reviewable.io

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@palladia

George Fleming (palladia) commented Mar 23, 2016

Copy link
Copy Markdown
Contributor Author

Review status: all files reviewed at latest revision, 5 unresolved discussions.


src/Microsoft.PowerShell.Linux.Host/readline.cs, line 640 [r1] (raw file):
Except that to go from reverse search to forward search, you need to type "Enter". And once you type "Enter", the "current" line is now the last line, and forward search becomes meaningless.


src/Microsoft.PowerShell.Linux.Host/readline.cs, line 698 [r1] (raw file):
Personally, I don't think we must match PSReadLine's wording. But I also don't have reasons not to. :) I will modify.


Comments from the review on Reviewable.io

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

George Fleming (palladia) added 9 commits March 23, 2016 14:11
@palladia
Pending verification of TreatControlCAsInput
cc0b25e
@palladia
Tested, except for reversed TreatControlCAsInput
2deb871
@palladia
Adding support for Ctrl-K, Ctrl-Y, and Ctrl-L
e713af8
@palladia
Render multi-line command as a single-line command
89839b6
@palladia
Add Ctrl-R reverse search
2708d2b
@palladia
Add color to reverse search
d234ca2
@palladia
Fix rendering issue with leading spaces, and added support for additi…
5a487f0
…onal ctrl commands
@palladia
Reverse TreatControlCAsInput now that CoreFx fix has arrived
d565462
@palladia
Fixes UI-related bugs, and migrate Console.Write to myHost.UI.Write
aab00e2
@andyleejordan

Andy Jordan (andyleejordan) commented Mar 23, 2016

Copy link
Copy Markdown
Member

Review status: all files reviewed at latest revision, 5 unresolved discussions.


src/Microsoft.PowerShell.Linux.Host/readline.cs, line 640 [r1] (raw file):
That doesn't seem to be the case with PSReadLine on Windows.


src/Microsoft.PowerShell.Linux.Host/readline.cs, line 698 [r1] (raw file):
Thanks.


Comments from the review on Reviewable.io

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@palladia

George Fleming (palladia) commented Mar 23, 2016

Copy link
Copy Markdown
Contributor Author

Review status: all files reviewed at latest revision, 4 unresolved discussions.


src/Microsoft.PowerShell.Linux.Host/readline.cs, line 615 [r1] (raw file):
Done.


src/Microsoft.PowerShell.Linux.Host/readline.cs, line 617 [r1] (raw file):
Done.


src/Microsoft.PowerShell.Linux.Host/readline.cs, line 621 [r1] (raw file):
Done.


src/Microsoft.PowerShell.Linux.Host/readline.cs, line 640 [r1] (raw file):
Not going to implement for now, since it was agreed at Stand Up that we don't need this right now.


src/Microsoft.PowerShell.Linux.Host/readline.cs, line 698 [r1] (raw file):
Done.


Comments from the review on Reviewable.io

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@palladia
Changes per Andy comments, and add revert of colors at end of PS
5e9c311
@palladia
George Fleming (palladia) force-pushed the rawui2 branch from dc66916 to 5e9c311 Compare March 23, 2016 23:31
@andyleejordan

Andy Jordan (andyleejordan) commented Mar 24, 2016

Copy link
Copy Markdown
Member

Reviewed 2 of 2 files at r2.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from the review on Reviewable.io

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@andyleejordan

Andy Jordan (andyleejordan) commented Mar 24, 2016

Copy link
Copy Markdown
Member

This is good, going to merge. We still have some open questions, but I'll create separate issues (some of the require more discussion than we should do here).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@andyleejordan
Andy Jordan (andyleejordan) merged commit 06ab38e into master Mar 24, 2016
@andyleejordan
Andy Jordan (andyleejordan) deleted the rawui2 branch March 24, 2016 00:56
@andyleejordan Andy Jordan (andyleejordan) removed the need review label Mar 24, 2016
This was referenced Mar 24, 2016
Replace use of System.Console with this.myHost.UI for output #616
Closed
Enable Ctrl-L clear screen #576
Closed
Ctrl-K kill and Ctrl-Y yank #574
Closed
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
@andyleejordan
Merge pull request PowerShell#730 from PowerShell/rawui2
1793285
MegaPatch that includes all of PowerShell#717, plus RawUI fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@palladia @andyleejordan
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.