Selaa lähdekoodia

add user scroll behavior

xuty 4 vuotta sitten
vanhempi
sitoutus
740aa878d1
1 muutettua tiedostoa jossa 6 lisäystä ja 1 poistoa
  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) {