Skip to content

Commit 50e26ec

Browse files
authored
Merge pull request #118 from tauu/backport-resize-logic
fix: backport resize logic
2 parents 2c6648b + 5fd07ac commit 50e26ec

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

lib/buffer/buffer.dart

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -505,12 +505,9 @@ class Buffer {
505505
}
506506

507507
if (newHeight > oldHeight) {
508-
while (lines.length < newHeight) {
509-
lines.push(_newEmptyLine());
510-
}
511508
// Grow larger
512509
for (var i = 0; i < newHeight - oldHeight; i++) {
513-
if (_cursorY < oldHeight - 1) {
510+
if (newHeight > lines.length) {
514511
lines.push(_newEmptyLine());
515512
} else {
516513
_cursorY++;
@@ -522,7 +519,7 @@ class Buffer {
522519
if (_cursorY < oldHeight - 1) {
523520
lines.pop();
524521
} else {
525-
_cursorY++;
522+
_cursorY--;
526523
}
527524
}
528525
}

0 commit comments

Comments
 (0)