summaryrefslogtreecommitdiff
path: root/src/app.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-08-09 09:41:06 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-08-09 09:41:06 +0300
commit4c277ce0e6efe5d372b399bd37eaef07d6ea8c1a (patch)
tree954e2e5f4b5c9840e90999178b972cc6b50d5f36 /src/app.c
parentec4a55a53c2ee358e0b6f6220a7fad6c83cb4101 (diff)
Closing tabs/window
Diffstat (limited to 'src/app.c')
-rw-r--r--src/app.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/app.c b/src/app.c
index fa7311c6..3a1fde85 100644
--- a/src/app.c
+++ b/src/app.c
@@ -406,6 +406,23 @@ iBool handleCommand_App(const char *cmd) {
406 refresh_Widget(tabs); 406 refresh_Widget(tabs);
407 return iTrue; 407 return iTrue;
408 } 408 }
409 else if (equal_Command(cmd, "tabs.close")) {
410 iWidget *tabs = findWidget_App("doctabs");
411 if (tabCount_Widget(tabs) > 1) {
412 size_t index = tabPageIndex_Widget(tabs, document_App());
413 iWidget *closed = removeTabPage_Widget(tabs, index);
414 destroy_Widget(closed); /* released later */
415 if (index == tabCount_Widget(tabs)) {
416 index--;
417 }
418 arrange_Widget(tabs);
419 postCommandf_App("tabs.switch page:%p", tabPage_Widget(tabs, index));
420 }
421 else {
422 postCommand_App("quit");
423 }
424 return iTrue;
425 }
409 else if (equal_Command(cmd, "quit")) { 426 else if (equal_Command(cmd, "quit")) {
410 SDL_Event ev; 427 SDL_Event ev;
411 ev.type = SDL_QUIT; 428 ev.type = SDL_QUIT;