Skip to content
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

No need to clear lines when it's not a menu completion rendering #3199

Merged
merged 1 commit into from
Feb 2, 2022
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
Diff view
Diff view
32 changes: 16 additions & 16 deletions PSReadLine/Completion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -506,26 +506,26 @@ public void DrawMenu(Menu previousMenu, bool menuSelect)
}
}

// if the menu has moved, we need to clear the lines under it
if (Top < PreviousTop)
if (menuSelect)
{
// In either of the following two cases, we will need to move the cursor to the next line:
// - if extra rows from previous menu were cleared, then we know the current line was erased
// but the cursor was not moved to the next line.
// - if 'CursorLeft != 0', then the rest of the last menu row was erased, but the cursor
// was not moved to the next line.
if (extraPreRowsCleared || console.CursorLeft != 0)
// if the menu has moved, we need to clear the lines under it
if (Top < PreviousTop)
{
// There are lines from the previous rendering that need to be cleared,
// so we are sure there is no need to scroll.
MoveCursorDown(1);
}
// In either of the following two cases, we will need to move the cursor to the next line:
// - if extra rows from previous menu were cleared, then we know the current line was erased
// but the cursor was not moved to the next line.
// - if 'CursorLeft != 0', then the rest of the last menu row was erased, but the cursor
// was not moved to the next line.
if (extraPreRowsCleared || console.CursorLeft != 0)
{
// There are lines from the previous rendering that need to be cleared,
// so we are sure there is no need to scroll.
MoveCursorDown(1);
}

Singleton.WriteBlankLines(PreviousTop - Top);
}
Singleton.WriteBlankLines(PreviousTop - Top);
}

if (menuSelect)
{
RestoreCursor();
console.CursorVisible = true;
}
Expand Down