Compare commits

..

2 Commits

Author SHA1 Message Date
Krzosa Karol
22a82db946 When jumping to command, first line is for issuing next command easily 2026-01-30 19:48:50 +01:00
Krzosa Karol
4e8987101d Addressing the C:/Program Files (x86)/ situation 2026-01-30 19:34:05 +01:00
2 changed files with 48 additions and 14 deletions

View File

@@ -309,11 +309,6 @@ API Int GetWordEnd(Buffer *buffer, Int pos) {
return 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) { 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'@'; bool result = w == u'-' || w == u'/' || w == u'\\' || w == u':' || w == u'$' || w == u'_' || w == u'.' || w == u'!' || w == u'@';
if (!result) { 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 ResolveOpen(Allocator alo, Window *window, String path, ResolveOpenMeta meta) {
ResolvedOpen result = {}; ResolvedOpen result = {};
path = Trim(path); path = Trim(path);
@@ -285,7 +290,48 @@ ResolvedOpen ResolveOpen(Allocator alo, Window *window, String path, ResolveOpen
} }
path = {pstart.data, (Int)(p.data - pstart.data)}; 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); p = Skip(p, 1);
result.line = SkipInt(&p); result.line = SkipInt(&p);
if (At(p, 0) == ':') { if (At(p, 0) == ':') {
@@ -293,14 +339,6 @@ ResolvedOpen ResolveOpen(Allocator alo, Window *window, String path, ResolveOpen
Int b = SkipInt(&p); Int b = SkipInt(&p);
result.col = b; 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); Buffer *existing_buffer = GetBuffer(path, NULL);
@@ -365,6 +403,7 @@ BSet Open(Window *window, String path, ResolveOpenMeta meta, bool set_active = t
NextActiveWindowID = set.window->id; NextActiveWindowID = set.window->id;
} }
JumpTempBuffer(&set); JumpTempBuffer(&set);
RawAppend(set.buffer, u"\n");
Exec(set.view->id, false, o.path, GetPrimaryDirectory()); Exec(set.view->id, false, o.path, GetPrimaryDirectory());
} else if (o.kind == OpenKind_BackgroundExec) { } else if (o.kind == OpenKind_BackgroundExec) {
// this shouldn't change the focus/window/view // this shouldn't change the focus/window/view