A Chunk represent a sub part of a Buffer, and provides a set of operations for easily manipulating only that buffer section.
- The spec for Chunk
The corresponding Buffer for the chunk
True if the chunk is empty (i.e. includes zero characters), and false otherwise.
The end position of the chunk. The end position is inclusive, meaning that the
end_pos is included in the chunk.
The starting position of the chunk.
A table containing styling information for the chunk. The table contains three different value for each separate styling element in the chunk; the starting offset (number), the style applied (string) and the inclusive ending offset (number). Unlike other position values used within Chunk, these offset are byte based.
The text for the chunk. As noted in end_pos, the chunk’s range is inclusive, meaning that the end position is included. For example:
buffer = howl.Buffer() buffer.text = 'Liñe 1' buffer:chunk(2, 4).text -- => 'iñe'
.text replaces the chunk context with the new string. For
buffer = howl.Buffer() buffer.text = 'Liñe 1' buffer:chunk(2, 4).text = 'ua' buffer.text -- => 'Lua 1'
Deletes the chunk from the associated Buffer.
Returns the length of the Chunk.
Returns the text of the Chunk.