Fix crash in LuaPrint
This commit is contained in:
@@ -176,8 +176,6 @@ char *C(const char *value) {
|
||||
}
|
||||
|
||||
S8_String LuaScript = R"==(
|
||||
-- @todo: should we rewrite linux paths to windows on windows and vice-versa?
|
||||
|
||||
function ExtractLineAndColumn(s)
|
||||
local line = 1
|
||||
local col = 1
|
||||
|
||||
@@ -221,7 +221,20 @@ For(arr.reverse_iter()) {
|
||||
#define For(array) ForItem(it, array)
|
||||
|
||||
constexpr int64_t SLICE_LAST = INT64_MIN;
|
||||
int64_t WideLength(wchar_t *string);
|
||||
inline int64_t StringLen(char *string) {
|
||||
if (!string) return 0;
|
||||
int64_t i = 0;
|
||||
while (string[i]) i += 1;
|
||||
return i;
|
||||
}
|
||||
|
||||
inline int64_t WideLength(wchar_t *string) {
|
||||
if (!string) return 0;
|
||||
int64_t len = 0;
|
||||
while (*string++ != 0)
|
||||
len++;
|
||||
return len;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
struct Slice {
|
||||
@@ -231,8 +244,8 @@ struct Slice {
|
||||
Slice() = default;
|
||||
Slice(T *s, int64_t l) : data(s), len(l) {}
|
||||
|
||||
Slice(char *s) : data(s), len(strlen(s)) {}
|
||||
Slice(const char *s) : data((char *)s), len(strlen((char *)s)) {}
|
||||
Slice(char *s) : data(s), len(StringLen(s)) {}
|
||||
Slice(const char *s) : data((char *)s), len(StringLen((char *)s)) {}
|
||||
Slice(const char *s, int64_t l) : data((char *)s), len(l) {}
|
||||
|
||||
Slice(wchar_t *s) : data(s), len(WideLength(s)) {}
|
||||
@@ -1584,13 +1597,6 @@ String Format(Allocator allocator, const char *data, ...) PrintfFormatAttribute(
|
||||
return result;
|
||||
}
|
||||
|
||||
int64_t WideLength(wchar_t *string) {
|
||||
int64_t len = 0;
|
||||
while (*string++ != 0)
|
||||
len++;
|
||||
return len;
|
||||
}
|
||||
|
||||
String16 ToString16(Allocator allocator, String string) {
|
||||
Assert(sizeof(wchar_t) == 2);
|
||||
wchar_t *buffer = (wchar_t *)AllocSize(allocator, sizeof(wchar_t) * (string.len + 1));
|
||||
|
||||
@@ -63,8 +63,6 @@ Style.FontSize = 12
|
||||
Style.FontFilter = 0
|
||||
Style.Font = "C:/Windows/Fonts/consola.ttf"
|
||||
|
||||
-- @todo: should we rewrite linux paths to windows on windows and vice-versa?
|
||||
|
||||
function ExtractLineAndColumn(s)
|
||||
local line = 1
|
||||
local col = 1
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
- search as a command to execute which is going to be in the title bar
|
||||
- search backwards
|
||||
- braces enclose should be performed even if we put the mouse out of bounds!
|
||||
|
||||
- word complete
|
||||
- Search all buffers in 10X style, incrementally searched results popping up on every key press (maybe we need coroutine library in C so this is easier?)
|
||||
|
||||
Reference in New Issue
Block a user