Debug memes

This commit is contained in:
Krzosa Karol
2024-08-09 16:33:23 +02:00
parent 93cfe71c21
commit 8bf32a557b
4 changed files with 12 additions and 7 deletions

1
.gitignore vendored
View File

@@ -5,3 +5,4 @@ x64/Release
src/external/SDL/
build/
*.rdbg
*.spall

View File

@@ -24,9 +24,10 @@ void AddCommonFlags(Array<S8_String> *cmd) {
if (Profile == PROFILE_DEBUG) {
cmd->add("-DDEBUG_BUILD=1");
cmd->add("-DRELEASE_BUILD=0");
// cmd->add("-fsanitize=address");
// cmd->add("-DUSE_ADDRESS_SANITIZER");
// cmd->add("-D_DEBUG /MDd");
cmd->add("-fsanitize=address");
cmd->add("-DUSE_ADDRESS_SANITIZER");
cmd->add("-D_DEBUG");
// cmd->add("/MDd");
} else {
cmd->add("-DDEBUG_BUILD=0");
cmd->add("-DRELEASE_BUILD=1");

View File

@@ -145,6 +145,12 @@ void AdjustCarets(Array<Edit> edits, Array<Caret> *carets, bool kill_selection =
carets->data[i].range.max = carets->data[i].range.min;
}
}
#if DEBUG_BUILD
For(*carets) {
Assert(it.range.max >= it.range.min);
}
#endif
}
bool KILL_SELECTION = true;

View File

@@ -111,9 +111,6 @@ void ReplaceTitleBarData(Window *window) {
Caret caret = last_view->carets[0];
XY xy = PosToXY(*last_buffer, GetFront(caret));
// @todo: this is still not quite correct, the carets here are not offset by edits
// so there will some problems here. I need to think about this in the future, maybe
// Command_Replace should return the edits and then you can offset manually!
Array<Caret> caret_copy = Copy(GetSystemAllocator(), view->carets);
defer {
Dealloc(&view->carets);