Add indentation engine and other fixes

This commit is contained in:
2026-01-12 22:48:51 +00:00
parent 9ed640c88e
commit 04cce25bf2
26 changed files with 763 additions and 186 deletions

View File

@@ -86,9 +86,9 @@ uint32_t count_clusters(const char *line, size_t len, size_t from, size_t to) {
return count;
}
int utf8_byte_offset_to_utf16(const char *s, size_t byte_pos) {
int utf16_units = 0;
size_t i = 0;
uint32_t utf8_byte_offset_to_utf16(const char *s, uint32_t byte_pos) {
uint32_t utf16_units = 0;
uint32_t i = 0;
while (i < byte_pos) {
unsigned char c = s[i];
if ((c & 0x80) == 0x00) {
@@ -108,9 +108,9 @@ int utf8_byte_offset_to_utf16(const char *s, size_t byte_pos) {
return utf16_units;
}
size_t utf16_offset_to_utf8(const char *s, int utf16_pos) {
int utf16_units = 0;
size_t i = 0;
uint32_t utf16_offset_to_utf8(const char *s, uint32_t utf16_pos) {
uint32_t utf16_units = 0;
uint32_t i = 0;
while (utf16_units < utf16_pos) {
unsigned char c = s[i];
if ((c & 0x80) == 0x00) {