commit 256ff3955e54c488b48a51113f56f9fd507cad85
parent 4e2cfe55274595f5c971b5e409a316a2091867d0
Author: ssnf <ssnf@ssnf.xyz>
Date: Mon, 19 May 2025 09:01:57 +0000
change charsiz to runesiz
Diffstat:
M | sim.c | | | 22 | +++++++++++----------- |
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/sim.c b/sim.c
@@ -100,7 +100,6 @@ static void buf_add(
static void buf_free(Buffer* p);
static int c2r(Rune *r, uchar c, uchar *seq);
static void change(int arg);
-static uint charsiz(char c, ulong wx);
static void count(int arg);
static void curmov(ushort x, ushort y);
static uint curpos(void);
@@ -132,6 +131,7 @@ static void paste(int arg);
static void pline(int arg);
static uchar r2u(char *s, Rune r);
static void resize(void);
+static uint runesiz(Rune c, ulong wx);
static void search(int arg);
static int selection(int arg);
static ulong str2u(char** buf, String s);
@@ -268,7 +268,7 @@ blind_reader(Frame* fr, Posn p0)
for (wx = 0; wx < w.wx && a.p1 < f->s.n;) {
if (f->s.s[a.p1] == '\n')
break;
- wx += charsiz(f->s.s[a.p1], wx);
+ wx += runesiz(f->s.s[a.p1], wx);
if (wx < w.wx)
++a.p1;
if (wx >= w.wx) {
@@ -409,14 +409,6 @@ change(int arg)
fr_update();
}
-static uint
-charsiz(char c, ulong wx)
-{
- if (c == '\n')
- die("charsiz(): newline.");
- return (c == '\t') ? w.t - (wx % w.t) : 1;
-}
-
static void
count(int arg)
{
@@ -441,7 +433,7 @@ curpos(void)
wx = 0;
for (i = fr->a[fr->cur].p0; i < f->dot.p1; ++i)
- wx += charsiz(f->s.s[i], wx);
+ wx += runesiz(f->s.s[i], wx);
return wx;
}
@@ -1125,6 +1117,14 @@ resize(void)
}
}
+static uint
+runesiz(Rune c, ulong wx)
+{
+ if (c == '\n')
+ die("runesiz(): newline.");
+ return (c == '\t') ? w.t - (wx % w.t) : 1;
+}
+
static void
search(int arg)
{