NewBufferAndLineOffsetsWithLimit returns an efficient implementation of Buffer for the given text and enforces a code point limit while constructing the buffer.
(data string, limit int)
| 141 | // NewBufferAndLineOffsetsWithLimit returns an efficient implementation of Buffer for the given text |
| 142 | // and enforces a code point limit while constructing the buffer. |
| 143 | func NewBufferAndLineOffsetsWithLimit(data string, limit int) (Buffer, []int32, error) { |
| 144 | if limit < 0 || len(data) <= limit { |
| 145 | return newBufferWithLimit(data, true, -1) |
| 146 | } |
| 147 | return newBufferWithLimit(data, true, limit) |
| 148 | } |
| 149 | |
| 150 | func countRemainingCodePoints(data string, idx int, count int) int { |
| 151 | for idx < len(data) { |