فهرست منبع

Add more comments

xuty 3 سال پیش
والد
کامیت
847009c170
2فایلهای تغییر یافته به همراه8 افزوده شده و 4 حذف شده
  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;
   final bool isAltBuffer;
 
 
-  Set<int>? wordSeparators;
+  /// Characters that break selection when calling [getWordBoundary]. If null,
+  /// defaults to [defaultWordSeparators].
+  final Set<int>? wordSeparators;
 
 
   Buffer(
   Buffer(
     this.terminal, {
     this.terminal, {
@@ -467,7 +469,7 @@ class Buffer {
     return line;
     return line;
   }
   }
 
 
-  static final _defaultWordSeparators = <int>{
+  static final defaultWordSeparators = <int>{
     0,
     0,
     r' '.codeUnitAt(0),
     r' '.codeUnitAt(0),
     r'.'.codeUnitAt(0),
     r'.'.codeUnitAt(0),
@@ -482,7 +484,7 @@ class Buffer {
   };
   };
 
 
   BufferRangeLine? getWordBoundary(CellOffset position) {
   BufferRangeLine? getWordBoundary(CellOffset position) {
-    var separators = wordSeparators ?? _defaultWordSeparators;
+    var separators = wordSeparators ?? defaultWordSeparators;
     if (position.y >= lines.length) {
     if (position.y >= lines.length) {
       return null;
       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.
   /// Flag to toggle os specific behaviors.
   final TerminalTargetPlatform platform;
   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({
   Terminal({
     this.maxLines = 1000,
     this.maxLines = 1000,