ansiPadLeft method

String ansiPadLeft(
  1. int length, {
  2. String pad = " ",
})

Pad string to the left, ignoring embedded ansi sequences.

Implementation

String ansiPadLeft(int length, {String pad = " "}) {
  final it = StringBuffer(this);
  while (ansiStripped(it.toString()).length < length) {
    final swap = it.toString();
    it.clear();
    it.write(pad);
    it.write(swap);
  }
  return it.toString();
}