FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

correctly presenting progressbar when buffer scrolls and clearing at end by SteveL-MSFT · Pull Request #3362 · PowerShell/PowerShell · GitHub

correctly presenting progressbar when buffer scrolls and clearing at end - #3362

Merged
Jason Shirk (lzybkr) merged 1 commit into
PowerShell:masterfrom
SteveL-MSFT:progressbar-2
Mar 19, 2017
Merged

correctly presenting progressbar when buffer scrolls and clearing at end#3362
Jason Shirk (lzybkr) merged 1 commit into
PowerShell:masterfrom
SteveL-MSFT:progressbar-2

Conversation

Copy link
Copy Markdown
Member

Windows progressbar requires ability to cache the screen buffer contents so it can write it back once progress is done. Linux doesn't provide a way for console apps to read the screen buffer (security concern). Changes:

  • scroll buffer appropriately by the size needed for progress bar if near bottom of screen, adjust progressbar location to account for scrolling
  • create an empty screen buffer used to clear the progress bar once done

No easy way to add tests for ProgressBar.

addresses #1625

Before the change:

After the change:

if (_location.Y >= _rawui.BufferSize.Height - rows)
//if the cursor is at the bottom, create screen buffer space by scrolling
int scrollRows = rows - ((_rawui.BufferSize.Height - 1) - _location.Y);
for (int i = 0; i < rows; i++)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

In rare cases, there may be junk on the screen below the prompt. Maybe we should be writing out spaces to make sure it's clear.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

If there's junk, it'll get overwritten anyways with tempProgressRegion where every cell has a character including spaces

Jason Shirk (lzybkr) self-assigned this Mar 19, 2017
Jason Shirk (lzybkr) merged commit 30eb61e into PowerShell:master Mar 19, 2017

Ilya (iSazonov) commented Mar 19, 2017
edited
Loading

Copy link
Copy Markdown
Collaborator

No easy way to add tests for ProgressBar.

We can try to use our TestHostCS.psm1

Steve Lee (SteveL-MSFT) deleted the progressbar-2 branch March 19, 2017 23:21

Copy link
Copy Markdown
Member Author

Ilya (@iSazonov) don't think TestHostCS.psm1 will help here since we're trying to validate how powershell.exe handles progressbar

Copy link
Copy Markdown
Contributor

Testing this would be similar to how I test PSReadline - I introduce a mock console interface, so instead of Console.Write, you write something more like _console.Write - then the test framework has a mock for the interface (which doesn't really exist, you need to invent one.)

It's a pain to write these tests and there is little return in that investment, so that's why I didn't ask Steve for any tests.

Copy link
Copy Markdown
Collaborator

there is little return in that investment

If the stock price change, I may try to enhance our TestHostCS.psm1 to support this scenarios. 😄

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL