Compare commits
2 Commits
034ac5d452
...
22a82db946
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
22a82db946 | ||
|
|
4e8987101d |
@@ -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) {
|
||||
|
||||
@@ -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,18 +290,51 @@ ResolvedOpen ResolveOpen(Allocator alo, Window *window, String path, ResolveOpen
|
||||
}
|
||||
path = {pstart.data, (Int)(p.data - pstart.data)};
|
||||
|
||||
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;
|
||||
// @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;
|
||||
}
|
||||
} else if (At(p, 0) == '(') {
|
||||
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) == ',') {
|
||||
if (At(p, 0) == ':') {
|
||||
p = Skip(p, 1);
|
||||
Int b = SkipInt(&p);
|
||||
result.col = b;
|
||||
@@ -365,6 +403,7 @@ BSet Open(Window *window, String path, ResolveOpenMeta meta, bool set_active = t
|
||||
NextActiveWindowID = set.window->id;
|
||||
}
|
||||
JumpTempBuffer(&set);
|
||||
RawAppend(set.buffer, u"\n");
|
||||
Exec(set.view->id, false, o.path, GetPrimaryDirectory());
|
||||
} else if (o.kind == OpenKind_BackgroundExec) {
|
||||
// this shouldn't change the focus/window/view
|
||||
|
||||
Reference in New Issue
Block a user