فهرست منبع

Add more comments

xuty 2 سال پیش
والد
کامیت
a3cca7fc4c
1فایلهای تغییر یافته به همراه17 افزوده شده و 3 حذف شده
  1. 17 3
      lib/src/core/tabs.dart

+ 17 - 3
lib/src/core/tabs.dart

@@ -2,20 +2,23 @@ import 'dart:math' show min;
 
 const _kMaxColumns = 1024;
 
+/// Manages the tab stop state for a terminal.
 class TabStops {
   final _stops = List<bool>.filled(_kMaxColumns, false);
 
   TabStops() {
-    setUpTabs();
+    _initialize();
   }
 
-  void setUpTabs() {
+  /// Initializes the tab stops to the default 8 column intervals.
+  void _initialize() {
     const interval = 8;
     for (var i = 0; i < _kMaxColumns; i += interval) {
       _stops[i] = true;
     }
   }
 
+  /// Finds the next tab stop between [start] and [end].
   int? find(int start, int end) {
     if (start >= end) {
       return null;
@@ -29,26 +32,37 @@ class TabStops {
     return null;
   }
 
+  /// Sets the tab stop at [index]. If there is already a tab stop at [index],
+  /// this method does nothing.
+  ///
+  /// See also:
+  /// * [clearAt] which does the opposite.
   void setAt(int index) {
     assert(index >= 0 && index < _kMaxColumns);
     _stops[index] = true;
   }
 
+  /// Clears the tab stop at [index]. If there is no tab stop at [index], this
+  /// method does nothing.
   void clearAt(int index) {
     assert(index >= 0 && index < _kMaxColumns);
     _stops[index] = false;
   }
 
+  /// Clears all tab stops without resetting them to the default 8 column
+  /// intervals.
   void clearAll() {
     _stops.fillRange(0, _kMaxColumns, false);
   }
 
+  /// Returns true if there is a tab stop at [index].
   bool isSetAt(int index) {
     return _stops[index];
   }
 
+  /// Resets the tab stops to the default 8 column intervals.
   void reset() {
     clearAll();
-    setUpTabs();
+    _initialize();
   }
 }