浏览代码

Proper AutoWrapMode

marks newly created lines with "isWrapped" so that the resize operation can respect that and unwrap those lines
devmil 4 年之前
父节点
当前提交
1a8e074398
共有 3 个文件被更改,包括 7 次插入4 次删除
  1. 3 0
      lib/buffer/buffer.dart
  2. 3 4
      lib/buffer/buffer_line.dart
  3. 1 0
      lib/terminal/terminal.dart

+ 3 - 0
lib/buffer/buffer.dart

@@ -85,6 +85,9 @@ class Buffer {
     if (_cursorX >= terminal.viewWidth) {
       newLine();
       setCursorX(0);
+      if (terminal.autoWrapMode) {
+        currentLine.isWrapped = true;
+      }
     }
 
     final line = currentLine;

+ 3 - 4
lib/buffer/buffer_line.dart

@@ -26,14 +26,13 @@ const _cellWidth = 12;
 const _cellFlags = 13;
 
 class BufferLine {
-  BufferLine({bool isWrapped = false}) : _isWrapped = isWrapped {
+  BufferLine({this.isWrapped = false}) {
     _cells = ByteData(_maxCols * _cellSize);
   }
 
   late ByteData _cells;
 
-  bool get isWrapped => _isWrapped;
-  bool _isWrapped = false;
+  bool isWrapped;
 
   int _maxCols = 64;
 
@@ -97,7 +96,7 @@ class BufferLine {
       cellErase(i, cursor);
     }
     if (resetIsWrapped) {
-      _isWrapped = false;
+      isWrapped = false;
     }
   }
 

+ 1 - 0
lib/terminal/terminal.dart

@@ -93,6 +93,7 @@ class Terminal with Observable {
 
   bool _screenMode = false; // DECSCNM (black on white background)
   bool _autoWrapMode = true;
+  bool get autoWrapMode => _autoWrapMode;
 
   /// ### DECOM – Origin Mode (DEC Private)
   ///