devmil пре 4 година
родитељ
комит
a9df5f5814
2 измењених фајлова са 6 додато и 7 уклоњено
  1. 6 5
      lib/buffer/buffer.dart
  2. 0 2
      lib/terminal/terminal.dart

+ 6 - 5
lib/buffer/buffer.dart

@@ -108,12 +108,13 @@ class Buffer {
       return lines.last;
     }
 
-    // while (index >= lines.length) {
-    //   final newLine = BufferLine();
-    //   lines.add(newLine);
-    // }
+    final rawIndex = convertViewLineToRawLine(index);
 
-    return lines[convertViewLineToRawLine(index)];
+    if(rawIndex >= lines.length) {
+      return BufferLine();
+    }
+
+    return lines[rawIndex];
   }
 
   BufferLine get currentLine {

+ 0 - 2
lib/terminal/terminal.dart

@@ -327,8 +327,6 @@ class Terminal with Observable {
   /// Resize the terminal screen. [newWidth] and [newHeight] should be greater
   /// than 0.
   void resize(int newWidth, int newHeight) {
-    final cursorY = buffer.convertViewLineToRawLine(buffer.cursorY);
-
     final oldWidth = _viewWidth;
     final oldHeight = _viewHeight;