diff options
Diffstat (limited to 'src/app.c')
-rw-r--r-- | src/app.c | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -1245,9 +1245,13 @@ iBool handleCommand_App(const char *cmd) { | |||
1245 | return iTrue; | 1245 | return iTrue; |
1246 | } | 1246 | } |
1247 | else if (equal_Command(cmd, "tabs.close")) { | 1247 | else if (equal_Command(cmd, "tabs.close")) { |
1248 | iWidget *tabs = findWidget_App("doctabs"); | 1248 | iWidget * tabs = findWidget_App("doctabs"); |
1249 | size_t index = tabPageIndex_Widget(tabs, document_App()); | 1249 | const iRangecc tabId = range_Command(cmd, "id"); |
1250 | iBool wasClosed = iFalse; | 1250 | iWidget * doc = !isEmpty_Range(&tabId) ? findWidget_App(cstr_Rangecc(tabId)) |
1251 | : document_App(); | ||
1252 | iBool wasCurrent = (doc == (iWidget *) document_App()); | ||
1253 | size_t index = tabPageIndex_Widget(tabs, doc); | ||
1254 | iBool wasClosed = iFalse; | ||
1251 | if (argLabel_Command(cmd, "toright")) { | 1255 | if (argLabel_Command(cmd, "toright")) { |
1252 | while (tabCount_Widget(tabs) > index + 1) { | 1256 | while (tabCount_Widget(tabs) > index + 1) { |
1253 | destroy_Widget(removeTabPage_Widget(tabs, index + 1)); | 1257 | destroy_Widget(removeTabPage_Widget(tabs, index + 1)); |
@@ -1272,7 +1276,9 @@ iBool handleCommand_App(const char *cmd) { | |||
1272 | index--; | 1276 | index--; |
1273 | } | 1277 | } |
1274 | arrange_Widget(tabs); | 1278 | arrange_Widget(tabs); |
1275 | postCommandf_App("tabs.switch page:%p", tabPage_Widget(tabs, index)); | 1279 | if (wasCurrent) { |
1280 | postCommandf_App("tabs.switch page:%p", tabPage_Widget(tabs, index)); | ||
1281 | } | ||
1276 | } | 1282 | } |
1277 | else { | 1283 | else { |
1278 | postCommand_App("quit"); | 1284 | postCommand_App("quit"); |