From 4ab7e453e26afc6e9f4938c65f89463fbba9e267 Mon Sep 17 00:00:00 2001 From: Albert Cervin Date: Fri, 23 Aug 2024 17:07:27 +0200 Subject: Overhaul unicode parsing It now instead iterates the actual unicode code points. This is better than what it was previously doing but it is still not entirely correct w.r.t to unicode sequences. This handling of unicode code points does however make it slightly easier to handle UTF-16 if needed in the future. This also adds some long needed tests for buffer methods. --- src/main/cmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/cmds.c') diff --git a/src/main/cmds.c b/src/main/cmds.c index 4da8346..18f333d 100644 --- a/src/main/cmds.c +++ b/src/main/cmds.c @@ -258,7 +258,7 @@ void buffer_to_list_line(struct buffer *buffer, void *userdata) { buffer_add_text_property( listbuf, (struct location){.line = begin.line, .col = 0}, (struct location){.line = begin.line, - .col = buffer_num_chars(listbuf, begin.line)}, + .col = buffer_line_length(listbuf, begin.line)}, (struct text_property){.type = TextProperty_Data, .userdata = buffer}); } } -- cgit v1.2.3