Get info for lua commands on buffer, ctrl shift Q thing, packaging

This commit is contained in:
krzosa
2025-04-30 09:34:54 +02:00
parent 46dcd1cc4e
commit a00f8acd9a
11 changed files with 108 additions and 68 deletions

View File

@@ -136,6 +136,13 @@ bool Seek(String16 string, String16 find, int64_t *index_out = NULL, SeekFlag fl
return result;
}
String16 CutLastSlash(String16 *s) {
String16 result = *s;
Seek(*s, u"/", &s->len, SeekFlag_MatchFindLast);
result = Skip(result, s->len);
return result;
}
String16 ChopLastSlash(String16 s) {
String16 result = s;
Seek(s, u"/", &result.len, SeekFlag_MatchFindLast);
@@ -297,26 +304,3 @@ String16 SkipWhitespace(String16 *string) {
}
return begin;
}
String16 Format16V(Allocator allocator, const char16_t *data, va_list args1) {
va_list args2;
va_copy(args2, args1);
int64_t len = vswprintf(0, 0, (wchar_t *)data, args2); // @todo: check this type
va_end(args2);
char16_t *result = (char16_t *)AllocSize(allocator, sizeof(char16_t) * (len + 1));
vswprintf((wchar_t *)result, (int)(len + 1), (wchar_t *)data, args1); // @todo: check this type
String16 res = {result, len};
return res;
}
#define STRING16_FORMAT(allocator, data, result) \
va_list args1; \
va_start(args1, data); \
String16 result = Format16V(allocator, data, args1); \
va_end(args1)
String16 Format16(Allocator allocator, const char16_t *data, ...) {
STRING16_FORMAT(allocator, data, result);
return result;
}