Compare commits

...

2 Commits

Author SHA1 Message Date
Krzosa Karol
903159d2bd SelectComment 2026-01-30 22:16:22 +01:00
Krzosa Karol
a87d2491bb Add warnings in remedy and remove QueryUserFile (not very good currently) 2026-01-30 22:16:16 +01:00
2 changed files with 35 additions and 2 deletions

View File

@@ -226,4 +226,33 @@ void CheckKeybindingColission() {
} }
} }
} }
} }
Range EncloseScope(Buffer *buffer, Int pos_min, Int pos_max, String16 open, String16 close) {
Range result = {pos_min, pos_max};
String16 buffer_string = GetString(buffer);
for (Int i = pos_min - 1; i >= 0; i -= 1) {
String16 string = Skip(buffer_string, i);
if (StartsWith(string, open)) {
result.min = i + open.len;
break;
}
}
for (Int i = pos_max; i < buffer->len; i += 1) {
String16 string = Skip(buffer_string, i);
if (StartsWith(string, close)) {
result.max = i;
break;
}
}
return result;
}
void CMD_SelectComment() {
BSet active = GetBSet(ActiveWindowID);
For (active.view->carets) {
Range scope = EncloseScope(active.buffer, it.range.min, it.range.max, u"/*", u"*/");
it.range = scope;
}
} RegisterCommand(CMD_SelectComment, "ctrl-shift-l", "Find /* and */ and select the content in between");

View File

@@ -2116,6 +2116,9 @@ bool RDBG_InitConnection(mco_coro *co, bool create_session = true) {
ResolvedOpen res = ResolveOpen(ctx->arena, window, BinaryUnderDebug, ResolveOpenMeta_DontError | ResolveOpenMeta_DontExec); ResolvedOpen res = ResolveOpen(ctx->arena, window, BinaryUnderDebug, ResolveOpenMeta_DontError | ResolveOpenMeta_DontExec);
if (res.kind == OpenKind_Goto) { if (res.kind == OpenKind_Goto) {
file = Intern(&GlobalInternTable, res.path); file = Intern(&GlobalInternTable, res.path);
} else {
ReportErrorf("Failed to find the executable pointer by BinaryUnderDebug: %S", BinaryUnderDebug);
return false;
} }
} }
@@ -2130,7 +2133,8 @@ bool RDBG_InitConnection(mco_coro *co, bool create_session = true) {
} }
if (file.len == 0) { if (file.len == 0) {
file = QueryUserFile(co); ReportWarningf("Couldn't find neither .rdbg file, nor use the BinaryUnderDebug variable to locate the binary");
return false;
} }
} }