fix: language & format

This commit is contained in:
javalsai 2025-06-21 00:54:36 +02:00
parent e7ef64cd16
commit 6d30e889d5
Signed by: javalsai
SSH Key Fingerprint: SHA256:3G83yKhBUWVABVX/vPWH88xnK4+ptMtHkZGCRXD4Mk8
4 changed files with 16 additions and 12 deletions

View File

@ -12,8 +12,9 @@ struct status {
};
int read_desktop(FILE* NNULLABLE fd, void* UNULLABLE ctx,
struct status (*NNULLABLE cb)(void* UNULLABLE ctx, char* NULLABLE table,
char* NNULLABLE key,
char* NNULLABLE value));
struct status (*NNULLABLE cb)(void* UNULLABLE ctx,
char* NULLABLE table,
char* NNULLABLE key,
char* NNULLABLE value));
#endif

View File

@ -127,10 +127,10 @@ struct parser_error parse_key(enum introspection_type typ, union typ_ptr at,
if (!aux_str) FAIL("allocation failure");
aux_err = parse_str_inplace(aux_str);
if (aux_err.msg != NULL) return aux_err;
// FIXME: it be broken, prob the ptr arithmetic or smth, we mem leak instead 😎
// If the ptr is not the default it means it was prev allocated, we should
// free
// if (*(char**)((uintptr_t)(&default_config) + offset) != *at.string) {
// FIXME: it be broken, prob the ptr arithmetic or smth, we mem leak
// instead 😎 If the ptr is not the default it means it was prev
// allocated, we should free if (*(char**)((uintptr_t)(&default_config) +
// offset) != *at.string) {
// free(*at.string);
// }
*at.string = aux_str;

View File

@ -33,11 +33,12 @@ void ofield_kbd_type(struct opts_field* self, char* typed,
}
bool ofield_opts_seek(struct opts_field* self, char seek) {
// no options or (a single option but its selected isntead of on edit)
// no options or (a single option but its selected instead of on edit)
if (self->opts == 0 || (self->opts == 1 && self->current_opt != 0))
return false;
self->current_opt = 1 + ((self->current_opt - 1 + seek + self->opts) % self->opts);
self->current_opt =
1 + ((self->current_opt - 1 + seek + self->opts) % self->opts);
ui_update_ofield(self);
return true;
}

View File

@ -90,16 +90,18 @@ size_t utf8len_until(const char* str, const char* until) {
}
const char* utf8back(const char* str) {
while(utf8_iscont(*(--str))) {}
while (utf8_iscont(*(--str))) {
}
return str;
}
const char* utf8seek(const char* str) {
while(utf8_iscont(*(++str))) {}
while (utf8_iscont(*(++str))) {
}
return str;
}
const char* utf8seekn(const char* str, size_t n) {
while(n > 0 && *str != '\0') {
while (n > 0 && *str != '\0') {
str = utf8seek(str);
n--;
}