Kaynağa Gözat

Add more comments

xuty 3 yıl önce
ebeveyn
işleme
847009c170
2 değiştirilmiş dosya ile 8 ekleme ve 4 silme
  1. 5 3
      lib/src/core/buffer/buffer.dart
  2. 3 1
      lib/src/terminal.dart

+ 5 - 3
lib/src/core/buffer/buffer.dart

@@ -18,7 +18,9 @@ class Buffer {
 
   final bool isAltBuffer;
 
-  Set<int>? wordSeparators;
+  /// Characters that break selection when calling [getWordBoundary]. If null,
+  /// defaults to [defaultWordSeparators].
+  final Set<int>? wordSeparators;
 
   Buffer(
     this.terminal, {
@@ -467,7 +469,7 @@ class Buffer {
     return line;
   }
 
-  static final _defaultWordSeparators = <int>{
+  static final defaultWordSeparators = <int>{
     0,
     r' '.codeUnitAt(0),
     r'.'.codeUnitAt(0),
@@ -482,7 +484,7 @@ class Buffer {
   };
 
   BufferRangeLine? getWordBoundary(CellOffset position) {
-    var separators = wordSeparators ?? _defaultWordSeparators;
+    var separators = wordSeparators ?? defaultWordSeparators;
     if (position.y >= lines.length) {
       return null;
     }

+ 3 - 1
lib/src/terminal.dart

@@ -62,7 +62,9 @@ class Terminal with Observable implements TerminalState, EscapeHandler {
   /// Flag to toggle os specific behaviors.
   final TerminalTargetPlatform platform;
 
-  Set<int>? wordSeparators;
+  /// Characters that break selection when double clicking. If not set, the
+  /// [Buffer.defaultWordSeparators] will be used.
+  final Set<int>? wordSeparators;
 
   Terminal({
     this.maxLines = 1000,