File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -326,11 +326,18 @@ static int FindCommonPrefixLength(string leftStr, string rightStr)
326
326
327
327
// If we had to wrap to render everything, update _initialY
328
328
var endPoint = ConvertOffsetToPoint ( currentBuffer . Length ) ;
329
- int physicalLine = endPoint . Y - _initialY ;
330
- if ( _initialY + physicalLine > bufferHeight )
329
+ if ( endPoint . Y >= bufferHeight )
331
330
{
331
+
332
332
// We had to scroll to render everything, update _initialY.
333
- _initialY = bufferHeight - physicalLine ;
333
+ int offset = 1 ; // Base case to handle zero-indexing.
334
+ if ( endPoint . X == 0 )
335
+ {
336
+ // The line hasn't actually wrapped yet because we have exactly filled the line.
337
+ offset -= 1 ;
338
+ }
339
+ int scrolledLines = endPoint . Y - bufferHeight + offset ;
340
+ _initialY -= scrolledLines ;
334
341
}
335
342
336
343
// Preserve the current render data.
@@ -347,8 +354,8 @@ static int FindCommonPrefixLength(string leftStr, string rightStr)
347
354
if ( point . Y == bufferHeight )
348
355
{
349
356
// The cursor top exceeds the buffer height and it hasn't already wrapped,
350
- // so we need to scroll up the buffer by 1 line.
351
- if ( point . X == 0 )
357
+ // (because we have exactly filled the line) so we need to scroll up the buffer by 1 line.
358
+ if ( point . X == 0 && ! currentBuffer . EndsWith ( " \n " ) )
352
359
{
353
360
_console . Write ( "\n " ) ;
354
361
}
You can’t perform that action at this time.
0 commit comments