Add proper selection modes and word jumping

This commit is contained in:
2025-12-13 20:43:04 +00:00
parent 5153770ee9
commit 628000f851
8 changed files with 317 additions and 47 deletions

View File

@@ -148,6 +148,20 @@ uint32_t get_bytes_from_visual_col(const char *line, uint32_t len,
return current_byte;
}
uint32_t count_clusters(const char *line, size_t len, size_t from, size_t to) {
uint32_t count = 0;
size_t pos = from;
while (pos < to && pos < len) {
size_t next =
pos + grapheme_next_character_break_utf8(line + pos, len - pos);
if (next > to)
break;
pos = next;
count++;
}
return count;
}
void log(const char *fmt, ...) {
FILE *fp = fopen("/tmp/log.txt", "a");
if (!fp)