Major changes to api and structure.

- Remove newline caching
- limit petal sizes
- make public facing api use points only
- fix iterators (chunk & line)
This commit is contained in:
2026-08-02 11:07:04 +01:00
parent 89b24a7488
commit 51e193d28b
16 changed files with 355 additions and 422 deletions
+2 -18
View File
@@ -12,31 +12,15 @@ struct AppendBuffer : Buffer {
uint32_t current_offset{0};
uint32_t t_offset{0};
using LChunk = uint32_t[CHUNK_SIZE];
std::vector<LChunk *> newlines;
LChunk *l_current;
uint32_t l_offset{0};
AppendBuffer();
~AppendBuffer();
uint32_t key(char c);
uint32_t append(const char *text, uint32_t length, uint32_t *line_count);
uint32_t append(const char *text, uint32_t length);
const char *read(uint32_t pos, uint32_t *out_len);
uint32_t count_lines(uint32_t pos, uint32_t length);
uint32_t next_newline(uint32_t pos);
uint32_t nth_newline(uint32_t pos, uint32_t n);
private:
inline uint32_t newline_value_at(uint32_t flat_index);
inline uint32_t length();
inline void new_text_chunk();
inline void new_line_chunk();
inline uint32_t find_newline(uint32_t target, uint32_t low, uint32_t high);
inline uint32_t _append(const char *text, uint32_t length);
};