From f90d5e1f07fdc9dea7c24b11107049b613a5be7a Mon Sep 17 00:00:00 2001 From: Albert Cervin Date: Sun, 29 Jan 2023 22:22:54 +0100 Subject: More tests and documentation Also improve find file and switch buffer a bit. Implement word backward/forward. --- src/text.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/text.c') diff --git a/src/text.c b/src/text.c index d1a0db3..ec80643 100644 --- a/src/text.c +++ b/src/text.c @@ -80,6 +80,11 @@ uint32_t byteidx_to_charidx(struct line *line, uint32_t byte_idx) { return utf8_nchars(line->data, byte_idx); } +uint32_t text_byteindex_to_col(struct text *text, uint32_t line, + uint32_t byteindex) { + return byteidx_to_charidx(&text->lines[line], byteindex); +} + void insert_at_col(struct line *line, uint32_t col, uint8_t *text, uint32_t len, uint32_t nchars) { -- cgit v1.2.3