Renamed every 'str' fiend and variable to 's'. Implemented edit_init.

This commit is contained in:
2026-01-09 00:46:42 +05:00
parent 11589d4623
commit b725182544
4 changed files with 95 additions and 81 deletions

View File

@@ -51,7 +51,7 @@ int main(void) {
TEST(scan_str("a").width == 1);
TEST(scan_str("äß\no").width == 2);
struct line ln = {.str = "foo\nbar"};
struct line ln = {.s = "foo\nbar"};
TEST(next_line(&ln) == true);
TEST(!memcmp(ln.line, "foo", ln.size));
TEST(next_line(&ln) == true);

View File

@@ -25,12 +25,12 @@ static inline void test_screen(struct event* e) {
label(buf, 2, 0, A, A, 0xf);
sprintf(buf, "frame : [%c] %d", ": "[tim.frame & 1], tim.frame);
label(buf, 2, 1, A, A, 0xf);
sprintf(buf, "key : [%d] %s", ke.key, ke.str + (ke.key < 32));
sprintf(buf, "key : [%d] %s", ke.key, ke.s + (ke.key < 32));
label(buf, 2, 2, A, A, 0xf);
sprintf(buf, "mouse : [%d] %d:%d", me.key, me.x, me.y);
label(buf, 2, 3, A, A, 0xf);
sprintf(buf, "input : %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx",
e->str[0], e->str[1], e->str[2], e->str[3], e->str[4], e->str[5], e->str[6], e->str[7]);
e->s[0], e->s[1], e->s[2], e->s[3], e->s[4], e->s[5], e->s[6], e->s[7]);
label(buf, 2, 4, A, A, 0xf);
// lower right
@@ -63,13 +63,13 @@ static inline void test_screen(struct event* e) {
}
// edit
static struct edit ed1 = {.str = "Edit 1"};
static struct edit ed1 = {.s = "Edit 1"};
static struct edit ed2 = {0};
edit(&ed1, 1, 10, 32, 0xff00ff);
sprintf(buf, "cursor: %d length: %d", ed1.cursor, ed1.length);
label(buf, 2, 13, A, A, 0xf);
edit(&ed2, 1, 14, 32, 0xff00ff);
label(ed2.str, 2, 17, A, A, 0xf);
label(ed2.s, 2, 17, A, A, 0xf);
// checkbox
static int chk[2] = {-1, 1};