Addressing the C:/Program Files (x86)/ situation

This commit is contained in:
Krzosa Karol
2026-01-30 19:34:05 +01:00
parent 034ac5d452
commit 4e8987101d
2 changed files with 47 additions and 14 deletions

View File

@@ -309,11 +309,6 @@ API Int GetWordEnd(Buffer *buffer, Int pos) {
return pos;
}
bool IsOpenBoundary(char c) {
bool result = c == 0 || IsParen(c) || IsBrace(c) || c == ':' || c == '\t' || c == '\n' || c == '"' || c == '\'';
return result;
}
API bool IsLoadWord(char16_t w) {
bool result = w == u'-' || w == u'/' || w == u'\\' || w == u':' || w == u'$' || w == u'_' || w == u'.' || w == u'!' || w == u'@';
if (!result) {

View File

@@ -212,6 +212,11 @@ void MouseLoadWord(Event event, ResolveOpenMeta meta = ResolveOpenMeta_Normal) {
}
}
bool IsOpenBoundary(char c) {
bool result = c == 0 || IsBrace(c) || c == ':' || c == '\t' || c == '\n' || c == '"' || c == '\'';
return result;
}
ResolvedOpen ResolveOpen(Allocator alo, Window *window, String path, ResolveOpenMeta meta) {
ResolvedOpen result = {};
path = Trim(path);
@@ -285,7 +290,48 @@ ResolvedOpen ResolveOpen(Allocator alo, Window *window, String path, ResolveOpen
}
path = {pstart.data, (Int)(p.data - pstart.data)};
if (At(p, 0) == ':') {
// @todo: verify!
// For (LINE:COLUMN): error: - we can either backtrack at the end since we are including
// the parenthesis and whitespace or alternatively we can look for patterns on every
// character move in the loop... For now let's do backtracking. This doesn't handle all paths
// but not sure if that's even what we want. ALL paths is hard.
{
Int i = path.len - 1;
if (At(path, i) == ')') {
i -= 1;
Int end = i;
while (IsDigit(At(path, i))) {
i -= 1;
}
Int start = i;
String b = {path.data + 1 + start, (end - start)};
if (At(path, i) == ')') {
i -= 1;
path.len = i + 1;
result.line = strtoll(b.data, NULL, 10);
} else if (At(path, i) == ',') {
i -= 1;
end = i;
while (IsDigit(At(path, i))) {
i -= 1;
}
start = i;
String a = {path.data + 1 + start, (end - start)};
if (At(path, i) == '(') {
i -= 1;
path.len = i + 1;
result.line = strtoll(a.data, NULL, 10);
result.col = strtoll(b.data, NULL, 10);
}
}
}
}
if (result.line == 0 && At(p, 0) == ':') {
p = Skip(p, 1);
result.line = SkipInt(&p);
if (At(p, 0) == ':') {
@@ -293,14 +339,6 @@ ResolvedOpen ResolveOpen(Allocator alo, Window *window, String path, ResolveOpen
Int b = SkipInt(&p);
result.col = b;
}
} else if (At(p, 0) == '(') {
p = Skip(p, 1);
result.line = SkipInt(&p);
if (At(p, 0) == ',') {
p = Skip(p, 1);
Int b = SkipInt(&p);
result.col = b;
}
}
Buffer *existing_buffer = GetBuffer(path, NULL);