format method

String format()

Implementation

String format() {
  final modMark = modified ? ' [+]' : '';
  final modeLabel = state.mode.label;
  final line = state.cursor.line + 1;
  final col = state.cursor.column + 1;
  final pct = totalLines == 0
      ? 'Top'
      : '${(line * 100 ~/ totalLines).clamp(0, 100)}%';

  final left = '-- $modeLabel -- $fileName$modMark';
  final right = '$line,$col   $pct';

  if (state.mode == VimMode.command) {
    return ':${state.commandBuffer}';
  }
  return '$left${' ' * max(0, 60 - left.length - right.length)}$right';
}