瀏覽代碼

add user scroll behavior

xuty 4 年之前
父節點
當前提交
740aa878d1
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      lib/buffer/buffer.dart

+ 6 - 1
lib/buffer/buffer.dart

@@ -272,9 +272,14 @@ class Buffer {
 
     // the cursor is not in the scrollable region
     if (_cursorY >= terminal.viewHeight - 1) {
-      // we are ait the bottom so a new line is created.
+      // we are at the bottom so a new line is created.
       lines.add(BufferLine());
 
+      // keep viewport from moving if user is scrolling.
+      if (isUserScrolling) {
+        _scrollOffsetFromBottom++;
+      }
+
       // clean extra lines if needed.
       final maxLines = terminal.maxLines;
       if (maxLines != null && lines.length > maxLines) {