8000 Progressbar messes up display if the cursor originally wasn't left most (x=0) by SteveL-MSFT · Pull Request #3453 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content

Progressbar messes up display if the cursor originally wasn't left most (x=0) #3453

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

Merged
merged 1 commit into from
Mar 31, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Dif 8000 f view
Diff view
12 changes: 12 additions & 0 deletions src/Microsoft.PowerShell.ConsoleHost/host/msh/ProgressPane.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,20 @@ class ProgressPane

int rows = tempProgressRegion.GetLength(0);
int cols = tempProgressRegion.GetLength(1);

_savedCursor = _rawui.CursorPosition;
_location.X = 0;

#if UNIX
_location.Y = _rawui.CursorPosition.Y;

// if cursor is not on left edge already move down one line
if (_rawui.CursorPosition.X != 0)
{
_location.Y++;
_rawui.CursorPosition = _location;
}

//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++)
Expand All @@ -105,6 +114,7 @@ class ProgressPane
if (scrollRows > 0)
{
_location.Y -= scrollRows;
_savedCursor.Y -= scrollRows;
}

//create cleared region to clear progress bar later
Expand Down Expand Up @@ -161,6 +171,7 @@ class ProgressPane

_rawui.SetBufferContents(_location, _savedRegion);
_savedRegion = null;
_rawui.CursorPosition = _savedCursor;
}
}

Expand Down Expand Up @@ -249,6 +260,7 @@ class ProgressPane


private Coordinates _location = new Coordinates(0, 0);
private Coordinates _savedCursor;
private Size _bufSize;
private BufferCell[,] _savedRegion;
private BufferCell[,] _progressRegion;
Expand Down
0