Ver código fonte

add isUserScrolling

xuty 4 anos atrás
pai
commit
6905ecc4a7
1 arquivos alterados com 7 adições e 0 exclusões
  1. 7 0
      lib/buffer/buffer.dart

+ 7 - 0
lib/buffer/buffer.dart

@@ -32,6 +32,13 @@ class Buffer {
     return terminal.invisibleHeight - scrollOffsetFromBottom;
   }
 
+  /// Indicated whether the terminal should automatically scroll to bottom when
+  /// new lines are added. When user is scrolling, [isUserScrolling] is true and
+  /// the automatical scroll-to-bottom behavior is disabled.
+  bool get isUserScrolling {
+    return _scrollOffsetFromBottom != 0;
+  }
+
   /// Horizontal position of the cursor relative to the top-left cornor of the
   /// screen, starting from 0.
   int get cursorX => _cursorX.clamp(0, terminal.viewWidth - 1);