Compare commits

...

2 Commits

Author SHA1 Message Date
Krzosa Karol
ba6de21396 Query file add UI indicator (but need something better ...), fix remedy 2026-01-23 22:36:11 +01:00
Krzosa Karol
b75e0a8a55 Add '..' to file listing 2026-01-23 22:35:12 +01:00
3 changed files with 51 additions and 45 deletions

View File

@@ -13,6 +13,7 @@ void InsertDirectoryNavigation(Buffer *buffer) {
Scratch scratch;
ResetBuffer(buffer);
RawAppendf(buffer, "\n");
RawAppendf(buffer, "..\n");
for (FileIter it = IterateFiles(scratch, buffer->name); IsValid(it); Advance(&it)) {
RawAppendf(buffer, "%S\n", it.filename);
}

View File

@@ -2108,6 +2108,31 @@ bool RDBG_InitConnection(mco_coro *co, bool create_session = true) {
}
}
String file = "";
if (create_session) {
if (BinaryUnderDebug.len) {
Window *window = GetWindow(PrimaryWindowID);
ResolvedOpen res = ResolveOpen(CoCurr->arena, window, BinaryUnderDebug, ResolveOpenMeta_DontError | ResolveOpenMeta_DontExec);
if (res.kind == OpenKind_Goto) {
file = Intern(&GlobalInternTable, res.path);
}
}
if (file.len == 0) {
Scratch scratch;
for (FileIter it = IterateFiles(scratch, ProjectDirectory); IsValid(it); Advance(&it)) {
if (EndsWith(it.filename, ".rdbg")) {
file = Intern(&GlobalInternTable, it.absolute_path);
break;
}
}
}
if (file.len == 0) {
file = QueryUserFile(co);
}
}
String session_name = Format(CoCurr->arena, "te%llu", GetTimeNanos());
String remedy_string = Format(CoCurr->arena, "%S --servername %S", RemedyBGPath, session_name);
ReportConsolef("Remedybg: %S", remedy_string);
@@ -2137,32 +2162,7 @@ bool RDBG_InitConnection(mco_coro *co, bool create_session = true) {
}
MemoryZero(RDBG_Ctx.last_error, sizeof(RDBG_Ctx.last_error));
if (create_session == false) {
return true;
}
String file = "";
if (BinaryUnderDebug.len) {
Window *window = GetWindow(PrimaryWindowID);
ResolvedOpen res = ResolveOpen(CoCurr->arena, window, BinaryUnderDebug, ResolveOpenMeta_DontError | ResolveOpenMeta_DontExec);
if (res.kind == OpenKind_Goto) {
file = Intern(&GlobalInternTable, res.path);
}
}
if (file.len == 0) {
Scratch scratch;
for (FileIter it = IterateFiles(scratch, ProjectDirectory); IsValid(it); Advance(&it)) {
if (EndsWith(it.filename, ".rdbg")) {
file = Intern(&GlobalInternTable, it.absolute_path);
}
}
}
if (file.len == 0) {
file = QueryUserFile(co);
}
if (create_session) {
if (EndsWith(file, ".rdbg")) {
ReportConsolef("Remedybg: OpenSession %S", file);
OpenSession(&RDBG_Ctx, file.data, &res);
@@ -2187,6 +2187,8 @@ bool RDBG_InitConnection(mco_coro *co, bool create_session = true) {
return true;
}
}
}
return true;
}

View File

@@ -152,6 +152,9 @@ String QueryUserFile(mco_coro *co) {
Window *window = GetWindow(PrimaryWindowID);
ViewID original_view = window->active_view;
Open(GetPrimaryDirectory());
BSet set = GetBSet(window);
RawReplaceText(set.buffer, {}, u"Point at a file you want to open!");
SelectRange(set.view, GetLineRangeWithoutNL(set.buffer, 0));
window->after_resolve_open_hook = DetectUserFileCallback;
String filename = "";
for (;;) {