Skip to content

Commit 4aebcdd

Browse files
committed
address feedback
1 parent 48d2c32 commit 4aebcdd

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

PSReadLine/Render.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ class RenderData
5050
lines = new[] { new RenderedLineData{ columns = 0, line = ""}}
5151
};
5252
private int _initialX;
53+
54+
// This represents the initial Y position of the cursor. If this position has scrolled off screen, this value will be negative indicating
55+
// the number of lines off screen.
5356
private int _initialY;
5457
private ConsoleColor _initialForeground;
5558
private ConsoleColor _initialBackground;
@@ -436,8 +439,8 @@ int PhysicalLineCount(int columns, bool isFirstLogicalLine, out int lenLastPhysi
436439
var lineData = renderLines[logicalLine];
437440
var physicalLineCount = PhysicalLineCount(lineData.columns, logicalLine == 0, out var lenLastLine);
438441

439-
// If the initial position was scrolled off the screen, only output for lines still
440-
// in the screen buffer
442+
// If the initial position was scrolled off the screen, _initialY will be negative.
443+
// Only output for lines still in the screen buffer.
441444
if (_initialY + physicalLine >= 0)
442445
{
443446
// First time redrawing from the top

test/KillYankTest.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4+
using System.Text;
45
using System.Windows;
56
using Microsoft.PowerShell;
67
using Xunit;
@@ -313,6 +314,23 @@ public void Paste()
313314
"echo foobar", _.CtrlShiftLeftArrow, _.CtrlV));
314315
}
315316

317+
[Fact]
318+
public void PasteLarge()
319+
{
320+
TestSetup(KeyMode.Cmd);
321+
322+
StringBuilder text = new StringBuilder();
323+
text.Append("@{");
324+
for (int i = 0; i < _console.BufferHeight + 10; i++)
325+
{
326+
text.Append(string.Format("prop{0}={0}", i));
327+
}
328+
text.Append("}");
329+
330+
Clipboard.SetText(text.ToString());
331+
Test(text.ToString(), Keys(_.CtrlV));
332+
}
333+
316334
[Fact]
317335
public void Cut()
318336
{

0 commit comments

Comments
 (0)