Truncated

class Truncated(val chunks0: Iterator<Str>, val width: Int, val height: Int, val truncationMarker: String = "...") : Iterator<Str>

Wraps an input iterator of colored s, and produces the same s but truncated once the wrapped-at-[width] text reaches beyond a certain [height]

Constructors

Link copied to clipboard
constructor(chunks0: Iterator<Str>, width: Int, height: Int, truncationMarker: String = "...")

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val height: Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val width: Int

Functions

Link copied to clipboard
open fun forEachRemaining(p0: Consumer<in Str>)
Link copied to clipboard
open operator override fun hasNext(): Boolean
Link copied to clipboard
open operator override fun next(): Str

[Truncated] streams the chunks one by one until it reaches the height limit; then, it buffers up to one entire row worth of chunks to check whether it overshoots. If it overshoots, it discards the chunks and prints "..." instead. If not, the buffered chunks get printed all at once.

Link copied to clipboard