Skip to content
Merged
Show file tree
Hide file tree
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
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/Microsoft.PowerShell.ConsoleHost/host/msh/ProgressPane.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,17 @@ class ProgressPane

//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++)
{
Console.Out.Write('\n');
}
if (scrollRows > 0)
{
// Scroll the console screen up by 'scrollRows'
var bottomLocation = _location;
bottomLocation.Y = _rawui.BufferSize.Height;
_rawui.CursorPosition = bottomLocation;
for (int i = 0; i < scrollRows; i++)
{
Console.Out.Write('\n');
}

_location.Y -= scrollRows;
_savedCursor.Y -= scrollRows;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2254,7 +2254,7 @@ internal void ThrowIfWriteNotPermitted(bool needsToWriteToPipeline)
{
// Only generate these exceptions if a pipeline has already been declared as the 'writing' pipeline.
// Otherwise, these are probably infrastructure messages and can be ignored.
if (this.PipelineProcessor._permittedToWrite != null)
if (this.PipelineProcessor?._permittedToWrite != null)
Copy link
Member

Choose a reason for hiding this comment

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

Could you add comment why did change was made?

Copy link
Contributor Author

@jianyunt jianyunt Jul 27, 2018

Choose a reason for hiding this comment

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

The line 2249 has

if (this.PipelineProcessor == null || _thisCommand != this.PipelineProcessor._permittedToWrite ...

When I debug the code, i saw nullref exceptions here.
Yes the change has nothing to do with the cursor position. But it's good to get rid of it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@adityapatwardhan In this case I don't think any comments are needed.

{
throw PSTraceSource.NewInvalidOperationException(
PipelineStrings.WriteNotPermitted);
Expand Down