浏览代码

Fixes "clear"

devmil 4 年之前
父节点
当前提交
e3558e56bb
共有 2 个文件被更改,包括 6 次插入0 次删除
  1. 1 0
      lib/buffer/buffer.dart
  2. 5 0
      lib/utli/circular_list.dart

+ 1 - 0
lib/buffer/buffer.dart

@@ -422,6 +422,7 @@ class Buffer {
   }
 
   void clear() {
+    lines.clear();
     for (int i = 0; i < terminal.viewHeight; i++) {
       lines.addNew();
     }

+ 5 - 0
lib/utli/circular_list.dart

@@ -71,6 +71,11 @@ class CircularList<T> {
     _array[_getCyclicIndex(index)] = value;
   }
 
+  void clear() {
+    _startIndex = 0;
+    _length = 0;
+  }
+
   void addNew() {
     _prepareItem(_array[_getCyclicIndex(_length)]);
     if (_length == _array.length) {