execAutoScroll method

void execAutoScroll()

Implementation

void execAutoScroll() {
  // print('controller.currentPointer.y -> ${currentPointer.y}');
  // print('buffer.limit -> ${currentBuffer.limit}');
  if (currentPointer.y + 1 > currentBuffer!.limit) {
    // print(
    //     '自动滑动 absLength:$absLength controller.rowLength:${controller.rowLength} controller.startLength:${controller.startLength}');
    // 上面这个if其实就是当终端视图下方还有显示内容的时候
    if (_autoScroll) {
      // print('滚动 pointer ${currentPointer}');
      // 只能延时执行刷新
      // print(controller.currentPointer.y + 1 - buffer.limit);
      Future.delayed(const Duration(milliseconds: 10), () {
        currentBuffer!.scroll(currentPointer.y + 1 - currentBuffer!.limit);
        // currentBuffer.scroll(-1);
        needBuild();
        notifyListeners();
      });
      // lastLetterPositionCall(
      //   -controller.theme.letterHeight *
      //       (controller.cache.length - realColumnLen - controller.startLine),
      // );
    }
  } else {
    // if (controller.autoScroll) {
    //   // 只能延时执行刷新
    //   Future.delayed(const Duration(milliseconds: 10), () {
    //     controller.startLength =
    //         absLength - controller.startLength - controller.rowLength;
    //     controller.dirty = true;
    //     controller.notifyListeners();
    //   });
    //   // lastLetterPositionCall(
    //   //   -controller.theme.letterHeight *
    //   //       (controller.cache.length - realColumnLen - controller.startLine),
    //   // );
    // }
  }
  if (currentBuffer!.absoluteLength() < currentBuffer!.limit) {
    /// 这个触发会在键盘放下的时候,最后一行不在可视窗口底部的时候
    // print(
    //     '自动滑动 absLength:$absLength controller.rowLength:${controller.rowLength} controller.startLength:${controller.startLength}');
    // 上面这个if其实就是当终端视图下方还有显示内容的时候
    if (_autoScroll) {
      // print('滚动 pointer ${currentPointer}');
      // 只能延时执行刷新
      // print(controller.currentPointer.y + 1 - buffer.limit);
      Future.delayed(const Duration(milliseconds: 10), () {
        currentBuffer!.scroll(
          currentBuffer!.absoluteLength() - currentBuffer!.limit,
        );
        needBuild();
        notifyListeners();
      });
      // lastLetterPositionCall(
      //   -controller.theme.letterHeight *
      //       (controller.cache.length - realColumnLen - controller.startLine),
      // );
    }
  }
}