summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorkatalx2026-01-29 03:20:42 -0500
committerkatalx2026-01-29 03:20:42 -0500
commit0feb6a86d49cedd15285064670382d2790524f21 (patch)
tree747696182e6fe2846ded6d6a30105ea987be27f0 /main.c
parent4173408110e55deb44644d9a8e15a8bb698f913d (diff)
utf-8 bullshit i guess
Diffstat (limited to 'main.c')
-rw-r--r--main.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/main.c b/main.c
index 44a8756..016035b 100644
--- a/main.c
+++ b/main.c
@@ -40,7 +40,7 @@ txt_insert(DynStr *s, int i, Str ins)
}
int
-txt_delete(DynStr *s, int i, int n)
+txt_delete_byte(DynStr *s, int i, int n)
{
if (n > i) n = i;
if (n > 0) {
@@ -51,6 +51,17 @@ txt_delete(DynStr *s, int i, int n)
}
int
+txt_delete(DynStr *s, int i, int n)
+{
+ while (n--) {
+ i = txt_delete_byte(s, i, 1);
+ while (i > 0 && (~s->v[i-1] & 0x80))
+ i = txt_delete_byte(s, i, 1);
+ }
+ return i;
+}
+
+int
read_all(FILE *f, DynStr *out, Arena *a)
{
char buf[256];