textmatrix v0.1.1 Textmatrix.Buffer View Source

Textmatrix.Buffer encapsules the characters present in the matrix split up in lines an characters.

Link to this section Summary

Functions

ensure_capacity/2 resizes the buffer to the minimum requirted capacity. If the buffer is already of or above the required size, it will return the buffer as is.

new/0 returns a new empty buffer

to_string/1 takes the buffer and converts it into a multiline string.

write/4 takes the buffer, x and y location and a string to write at that location. It returns an updated buffer.

Link to this section Types

Link to this type

t()

View Source
t() :: %Textmatrix.Buffer{lines: [Textmatrix.Line.t()]}

Link to this section Functions

Link to this function

ensure_capacity(buffer, max_index)

View Source
ensure_capacity(t(), integer()) :: t()

ensure_capacity/2 resizes the buffer to the minimum requirted capacity. If the buffer is already of or above the required size, it will return the buffer as is.

new/0 returns a new empty buffer

Link to this function

to_string(buffer, default_char \\ 32)

View Source

to_string/1 takes the buffer and converts it into a multiline string.

Link to this function

write(buffer, x, y, string)

View Source
write(t(), non_neg_integer(), non_neg_integer(), binary()) :: t()

write/4 takes the buffer, x and y location and a string to write at that location. It returns an updated buffer.

Link to this function

write_vertical(buffer, x, y, string)

View Source