diff options
| author | Albert Cervin <albert@acervin.com> | 2022-11-18 10:55:49 +0100 |
|---|---|---|
| committer | Albert Cervin <albert@acervin.com> | 2022-11-25 23:09:13 +0100 |
| commit | c40a1cfa0f1ecfddac06c7143c2dd974126ddad3 (patch) | |
| tree | 95410887b40166226e2c86001eb923cc51d8373d /src/text.h | |
| parent | 2f4cb88d5c60f725323739300bb49dfa8923e7d5 (diff) | |
| download | dged-c40a1cfa0f1ecfddac06c7143c2dd974126ddad3.tar.gz dged-c40a1cfa0f1ecfddac06c7143c2dd974126ddad3.tar.xz dged-c40a1cfa0f1ecfddac06c7143c2dd974126ddad3.zip | |
Rework delete logic a bit
It now handles a range of characters and correctly merges lines. It is
not the most slick implementation but it works as a start.
Diffstat (limited to 'src/text.h')
| -rw-r--r-- | src/text.h | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -15,7 +15,6 @@ void text_append(struct text *text, uint32_t line, uint32_t col, uint8_t *bytes, void text_delete(struct text *text, uint32_t line, uint32_t col, uint32_t nchars); -void text_delete_line(struct text *text, uint32_t line); uint32_t text_render(struct text *text, uint32_t line, uint32_t nlines, struct render_cmd *cmds, uint32_t max_ncmds); @@ -24,16 +23,18 @@ uint32_t text_num_lines(struct text *text); uint32_t text_line_length(struct text *text, uint32_t lineidx); uint32_t text_line_size(struct text *text, uint32_t lineidx); -struct txt_line { +struct text_chunk { uint8_t *text; uint32_t nbytes; uint32_t nchars; }; -typedef void (*line_cb)(struct txt_line *line); +typedef void (*chunk_cb)(struct text_chunk *chunk); void text_for_each_line(struct text *text, uint32_t line, uint32_t nlines, - line_cb callback); + chunk_cb callback); -struct txt_line text_get_line(struct text *text, uint32_t line); +void text_for_each_chunk(struct text *text, chunk_cb callback); + +struct text_chunk text_get_line(struct text *text, uint32_t line); bool text_line_contains_unicode(struct text *text, uint32_t line); |
