Command_CloseAll, Command_Quit, Command_NewWindow

This commit is contained in:
krzosa
2025-12-22 11:31:06 +01:00
parent 3ba7eeb1f2
commit 6243cace7d
9 changed files with 98 additions and 48 deletions

View File

@@ -410,25 +410,7 @@ void OnCommand(Event event) {
}
if (event.kind == EVENT_QUIT) {
Scratch scratch;
bool do_quit = true;
For (Buffers) {
if (it->garbage || it->dont_warn_on_save) {
continue;
}
if (it->dirty) {
int save = SaveMessageBox(it->name);
if (save == 0) {
break;
} else if (save == 2) {
SaveBuffer(it);
}
}
}
if (do_quit) {
AppIsRunning = false;
}
Command_Quit();
}
}
@@ -469,8 +451,8 @@ void GarbageCollect() {
IterRemove(Views) {
IterRemovePrepare(Views);
Buffer *buffer = GetBuffer(it->active_buffer);
if (it->kill == 0) {
Buffer *buffer = GetBuffer(it->active_buffer);
if (!buffer->garbage) {
continue;
}
@@ -481,6 +463,7 @@ void GarbageCollect() {
}
}
RawAppendf(GCInfoBuffer, "View %d %S\n", (int)it->id.id, buffer->name);
remove_item = true;
Dealloc(&it->carets);
Dealloc(sys_allocator, it);
@@ -506,6 +489,7 @@ void GarbageCollect() {
}
}
RawAppendf(GCInfoBuffer, "Buff %d %S\n", (int)it->id.id, it->name);
remove_item = true;
DeallocBuffer(it);
}
@@ -513,6 +497,7 @@ void GarbageCollect() {
IterRemove(Windows) {
IterRemovePrepare(Windows);
if (it->kill) {
RawAppendf(GCInfoBuffer, "Wind %d %S\n", (int)it->id.id);
Dealloc(&it->goto_history);
Dealloc(&it->goto_redo);
Dealloc(sys_allocator, it);