Quellcode durchsuchen

add user scroll behavior

xuty vor 4 Jahren
Ursprung
Commit
740aa878d1
1 geänderte Dateien mit 6 neuen und 1 gelöschten Zeilen
  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) {