-
Notifications
You must be signed in to change notification settings - Fork 63
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
get-history | Out-ConsoleGridView with multi-line commands causes issues #58
Comments
Looks like we just need to check if there are any newlines in the string here and add an "..." just like the output of if (strings[i].Contains(Environment.NewLine)
{
builder.Append(strings[i].Split(Environment.NewLine)[0]);
builder.Append("...");
} |
@tig any interest in contributing? |
Maybe. I have source cloned and can build ;-). Noted Contribution Guide is 404: https://powershell.github.io/GraphicalTools/CONTRIBUTING.html Also, can you point me at instructions for how to debug this using VS code? I set a BP on the line you pointed to and hit Debug in Code but hit issues that I don't understand (noob at using VS Code to debug; I generally use VS Studio). |
apologies for the 404! I'll get that fixed. @tig take a look at this section of the README for building. In order to debug in VS Code, start a PowerShell process and import your local build of Once you run |
Nevermind. Found it |
Is there some way to not have to kill the Windows Terminal session hosting |
You have to kill the pwsh.exe that imported the module because dlls can't be unloaded. What I usually do is:
That way your window doesn't close... just the pwsh process within. |
Ready to do a PR. before I do, here's the strategy I took... Your suggestion was to check for First, in my example (not sure of others where there's multi-line commands) I'm seeing only Second, just appending an ellipsis to the line is not very satisfyingly. In my example this would result in the command being displayed as:
Instead, I'm doing this:
Which lets the 'command too long' code deal gracefully with a command where newlines are encoded with the escape sequence. Thus the output looks like this: Cool? |
I think following PowerShell syntax, it may make more sense to replace |
I agree with @SteveL-MSFT |
"\r" and "\n" are not single control codes. Ideally we should escape output sting and mask all control characters and escape sequences. |
I actually tried that (using |
Yes, we can be iterative here and fix the newline characters first since they will be seen a lot more than others |
* Fixed #58: Multi-line commands rendering wrong * Fixed #58 - Newlines in commands render incorrectly * Added debug instructions to readme * Update src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs Co-Authored-By: Tyler James Leonhardt <tylerl0706@gmail.com> * simplified stripping of newline/linefeed * fixes Filter TextView and Apply button don't honor horizontal resizing * reverted move to terminal.gui 0.81.0 Co-authored-by: Tyler James Leonhardt <tylerl0706@gmail.com>
* Fixed #58: Multi-line commands rendering wrong * Fixed #58 - Newlines in commands render incorrectly * Added debug instructions to readme * Update src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs Co-Authored-By: Tyler James Leonhardt <tylerl0706@gmail.com> * simplified stripping of newline/linefeed * Upgrading to Terminal.gui 0.81.0 and its depencency on Nstack 0.14.0 Co-authored-by: Tyler James Leonhardt <tylerl0706@gmail.com>
* Fixed #58: Multi-line commands rendering wrong * Fixed #58 - Newlines in commands render incorrectly * Added debug instructions to readme * Update src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs Co-Authored-By: Tyler James Leonhardt <tylerl0706@gmail.com> * simplified stripping of newline/linefeed * fixed exit UI via StatusBar instead of Menu * fixes Filter TextView and Apply button don't honor horizontal resizing * removed commented out code * Add StatusBar label explainging that SPACE Marks Items * fixed spelling of delegate * removed Apply button Co-authored-by: Tyler James Leonhardt <tylerl0706@gmail.com>
* Fixed #58: Multi-line commands rendering wrong * Fixed #58 - Newlines in commands render incorrectly * Added debug instructions to readme * Update src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs Co-Authored-By: Tyler James Leonhardt <tylerl0706@gmail.com> * simplified stripping of newline/linefeed * ENTER now moves to list if on filter Co-authored-by: Tyler James Leonhardt <tylerl0706@gmail.com>
* Fixed #58: Multi-line commands rendering wrong * Fixed #58 - Newlines in commands render incorrectly * Added debug instructions to readme * Update src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs Co-Authored-By: Tyler James Leonhardt <tylerl0706@gmail.com> * simplified stripping of newline/linefeed * fixes to support gui.cs 0.89.3 * enhanced docs * formatting * partialy updated docs Co-authored-by: Tyler James Leonhardt <tylerl0706@gmail.com>
* Fixed #58: Multi-line commands rendering wrong * Fixed #58 - Newlines in commands render incorrectly * Added debug instructions to readme * Update src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs Co-Authored-By: Tyler James Leonhardt <tylerl0706@gmail.com> * simplified stripping of newline/linefeed * fixes to support gui.cs 0.89.3 * enhanced docs * formatting * partialy updated docs * fixed Single mode * fixed bug with filtering * updated build to also run ocgv * fixed f7 docs * fixed comment regarding selection mode formatting Co-authored-by: Tyler James Leonhardt <tylerl0706@gmail.com>
* Fixed #58: Multi-line commands rendering wrong * Fixed #58 - Newlines in commands render incorrectly * Added debug instructions to readme * Update src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs Co-Authored-By: Tyler James Leonhardt <tylerl0706@gmail.com> * simplified stripping of newline/linefeed * fixes to support gui.cs 0.89.3 * enhanced docs * formatting * partialy updated docs * fixed Single mode * fixed bug with filtering * updated build to also run ocgv * fixed f7 docs * fixed comment regarding selection mode formatting * Adds -Filter * undid spell check cahnge * undid spell check cahnge * undid spell check cahnge * removed orig file * per tylers feedback * updated .md * fixed md * Updated to pull FINAL gui.cs v0.90 release * updated psd to 0.60.0 and added release notes * fixed typo; added tags; hopefully this will unsick the mac build * fixed another typo Co-authored-by: Tyler James Leonhardt <tylerl0706@gmail.com>
* Fixed #58: Multi-line commands rendering wrong * Fixed #58 - Newlines in commands render incorrectly * Added debug instructions to readme * Update src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs Co-Authored-By: Tyler James Leonhardt <tylerl0706@gmail.com> * simplified stripping of newline/linefeed * update to new Terminal.gui package; no code changes Co-authored-by: Tyler James Leonhardt <tylerl0706@gmail.com>
* Fixed #58: Multi-line commands rendering wrong * Fixed #58 - Newlines in commands render incorrectly * Added debug instructions to readme * Update src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs Co-Authored-By: Tyler James Leonhardt <tylerl0706@gmail.com> * simplified stripping of newline/linefeed * made column spacing tigher * update to new Terminal.gui package; no code changes * removed excess padding on right * removed excess rows at bottom * status bar wsa occluding window * fixed build scripts to only build ocgv * use built-in command in build.ps1 * fixed the other one too Co-authored-by: Tyler James Leonhardt <tylerl0706@gmail.com>
* Fixed #58: Multi-line commands rendering wrong * Fixed #58 - Newlines in commands render incorrectly * Added debug instructions to readme * simplified stripping of newline/linefeed * made column spacing tighter * removed excess padding on right * removed excess rows at bottom * status bar wsa occluding window * fixed build scripts to only build ocgv * refactored to make logic more obvious * removed orig files * Updated references to latest Terminal.Gui * Fixed #131 and upgraded to terminal.gui 1.6, pwsh 7.2, and net60 * supported .net and reverted change * Fixes #131 - Out-ConsoleGridView doesn't handle ANSI escape sequences correctly * removed border when minui is enabled * re-implemented feature post merge screw up * improve VS code build and debug support * On exit, ensure only visible marked items are output * Fixes 87 * Fixing crash when MinUi PR is merged * Tweaked build to have a better test at end * removed merge artifacts * exclude .orig files (merge artifacts) Co-authored-by: Tyler James Leonhardt <tylerl0706@gmail.com> Co-authored-by: Andy Jordan <2226434+andschwa@users.noreply.github.com>
Start with:
Then
Results in something ugly like this:
Powershell 7.0.
The text was updated successfully, but these errors were encountered: