Skip to content

Commit 05f528d

Browse files
parkovskidaxian-dbw
authored andcommitted
Fix duplicate menu at end of buffer (#937)
1 parent 22ceb03 commit 05f528d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

PSReadLine/Completion.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,9 +471,12 @@ public void DrawMenu(Menu previousMenu, bool menuSelect)
471471
// Move cursor to the start of the first line after our input.
472472
var bufferEndPoint = Singleton.ConvertOffsetToPoint(Singleton._buffer.Length);
473473
console.SetCursorPosition(bufferEndPoint.X, bufferEndPoint.Y);
474+
// Top must be initialized before calling AdjustForPossibleScroll, otherwise
475+
// on the last line of the buffer, the scroll operation causes Top to point
476+
// past the buffer, which in turn causes the menu to be printed twice.
477+
this.Top = bufferEndPoint.Y + 1;
474478
AdjustForPossibleScroll(1);
475479
MoveCursorDown(1);
476-
this.Top = bufferEndPoint.Y + 1;
477480

478481
var bufferWidth = console.BufferWidth;
479482
var columnWidth = this.ColumnWidth;

0 commit comments

Comments
 (0)