Przeglądaj źródła

Running dartfmt

devmil 4 lat temu
rodzic
commit
1fdee9494a

+ 9 - 5
lib/buffer/buffer.dart

@@ -110,7 +110,7 @@ class Buffer {
 
     final rawIndex = convertViewLineToRawLine(index);
 
-    if(rawIndex >= lines.length) {
+    if (rawIndex >= lines.length) {
       return BufferLine();
     }
 
@@ -184,7 +184,8 @@ class Buffer {
     eraseLineFromCursor();
 
     for (var i = _cursorY + 1; i < terminal.viewHeight; i++) {
-      getViewLine(i).erase(terminal.cellAttr.value, 0, terminal.viewWidth, true);
+      getViewLine(i)
+          .erase(terminal.cellAttr.value, 0, terminal.viewWidth, true);
     }
   }
 
@@ -192,7 +193,8 @@ class Buffer {
     eraseLineToCursor();
 
     for (var i = 0; i < _cursorY; i++) {
-      getViewLine(i).erase(terminal.cellAttr.value, 0, terminal.viewWidth, true);
+      getViewLine(i)
+          .erase(terminal.cellAttr.value, 0, terminal.viewWidth, true);
     }
   }
 
@@ -204,7 +206,8 @@ class Buffer {
   }
 
   void eraseLineFromCursor() {
-    currentLine.erase(terminal.cellAttr.value, _cursorX, terminal.viewWidth, _cursorX == 0);
+    currentLine.erase(
+        terminal.cellAttr.value, _cursorX, terminal.viewWidth, _cursorX == 0);
   }
 
   void eraseLineToCursor() {
@@ -520,7 +523,8 @@ class Buffer {
     lines.removeAt(index);
   }
 
-  void resize(int width, int height, int oldWidth, int oldHeight, bool doReflow) {
+  void resize(
+      int width, int height, int oldWidth, int oldHeight, bool doReflow) {
     if (this.lines.length > 0) {
       if (oldHeight < height) {
         for (int y = oldHeight; y < height; y++) {

+ 9 - 7
lib/buffer/buffer_line.dart

@@ -48,7 +48,7 @@ class BufferLine {
         getCell(i).erase(attr);
       }
     }
-    if(_isWrapped && clearWrap) {
+    if (_isWrapped && clearWrap) {
       _isWrapped = false;
     }
   }
@@ -66,25 +66,27 @@ class BufferLine {
 
   void copyCellsFrom(BufferLine src, int srcCol, int dstCol, int len) {
     final requiredCells = dstCol + len;
-    if(_cells.length < requiredCells) {
-      _cells.addAll(List<Cell>.generate(requiredCells - _cells.length, (index) => Cell()));
+    if (_cells.length < requiredCells) {
+      _cells.addAll(List<Cell>.generate(
+          requiredCells - _cells.length, (index) => Cell()));
     }
     //we have to make a copy first as src and dst might be the same line
-    List<Cell> sourceCells = List<Cell>.generate(len, (index) => src._cells[srcCol + index].clone());
-    for(var i=0; i<len; i++) {
+    List<Cell> sourceCells =
+        List<Cell>.generate(len, (index) => src._cells[srcCol + index].clone());
+    for (var i = 0; i < len; i++) {
       _cells[dstCol + i] = sourceCells[i];
     }
   }
 
   int getWidthAt(int col) {
-    if(col >= _cells.length) {
+    if (col >= _cells.length) {
       return 1;
     }
     return _cells[col].width;
   }
 
   bool hasContentAt(int col) {
-    if(col >= _cells.length) {
+    if (col >= _cells.length) {
       return false;
     }
     return _cells[col].codePoint != 0;

+ 14 - 9
lib/buffer/buffer_reflow.dart

@@ -157,8 +157,8 @@ class BufferReflow {
 
       // Record original lines so they don't get overridden when we rearrange the list
       List<BufferLine> originalLines = List<BufferLine>.from(_buffer.lines);
-      _buffer.lines.addAll(List<BufferLine>.generate(countToInsert,
-              (index) => BufferLine()));
+      _buffer.lines.addAll(
+          List<BufferLine>.generate(countToInsert, (index) => BufferLine()));
 
       int originalLinesLength = originalLines.length;
 
@@ -267,8 +267,7 @@ class BufferReflow {
         //buffer doesn't have enough lines
         if (_buffer.lines.length < _buffer.terminal.viewHeight) {
           // Add an extra row at the bottom of the viewport
-          _buffer.lines
-              .add(BufferLine());
+          _buffer.lines.add(BufferLine());
         }
       }
     }
@@ -277,14 +276,16 @@ class BufferReflow {
   }
 
   void _reflowLargerApplyNewLayout(List<int> newLayout) {
-    var newLayoutLines = List<BufferLine>.generate(newLayout.length, (index) => _buffer.lines[newLayout[index]]);
+    var newLayoutLines = List<BufferLine>.generate(
+        newLayout.length, (index) => _buffer.lines[newLayout[index]]);
 
     // Rearrange the list
     for (int i = 0; i < newLayoutLines.length; i++) {
       _buffer.lines[i] = newLayoutLines[i];
     }
 
-    _buffer.lines.removeRange(newLayoutLines.length - 1, _buffer.lines.length - 1);
+    _buffer.lines
+        .removeRange(newLayoutLines.length - 1, _buffer.lines.length - 1);
   }
 
   LayoutResult _reflowLargerCreateNewLayout(
@@ -376,14 +377,18 @@ class BufferReflow {
             wrappedLines[destLineIndex].copyCellsFrom(
                 wrappedLines[destLineIndex - 1], colsAfter - 1, destCol++, 1);
             // Null out the end of the last row
-            wrappedLines[destLineIndex - 1]
-                .erase(_buffer.terminal.cellAttr.value, colsAfter - 1, colsAfter, false);
+            wrappedLines[destLineIndex - 1].erase(
+                _buffer.terminal.cellAttr.value,
+                colsAfter - 1,
+                colsAfter,
+                false);
           }
         }
       }
 
       // Clear out remaining cells or fragments could remain;
-      wrappedLines[destLineIndex].erase(_buffer.terminal.cellAttr.value, destCol, colsAfter, false);
+      wrappedLines[destLineIndex]
+          .erase(_buffer.terminal.cellAttr.value, destCol, colsAfter, false);
 
       // Work backwards and remove any rows at the end that only contain null cells
       int countToRemove = 0;

+ 2 - 1
lib/terminal/terminal.dart

@@ -334,7 +334,8 @@ class Terminal with Observable {
     _viewHeight = max(newHeight, 1);
 
     _altBuffer.resize(_viewWidth, _viewHeight, oldWidth, oldHeight, false);
-    _mainBuffer.resize(_viewWidth, _viewHeight, oldWidth, oldHeight, true /* might be a setting for the terminal */);
+    _mainBuffer.resize(_viewWidth, _viewHeight, oldWidth, oldHeight,
+        true /* might be a setting for the terminal */);
 
     if (buffer == _altBuffer) {
       buffer.clearScrollback();