about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-08-28 23:32:54 +0100
committerJames Booth <boothj5@gmail.com>2013-08-28 23:32:54 +0100
commita38953b6f8968ba41aab29e77c249b7168d83bd6 (patch)
tree19022d0e285b99e3a3d242a5c674c4816825a856 /src/command
parent4bfb369d2fe8295f3da008558a5580b9282c0f3c (diff)
downloadprofani-tty-a38953b6f8968ba41aab29e77c249b7168d83bd6.tar.gz
Fixed /close command
Diffstat (limited to 'src/command')
-rw-r--r--src/command/command.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/command/command.c b/src/command/command.c
index 360daa07..bae6a7c3 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -3026,23 +3026,22 @@ _cmd_close(gchar **args, struct cmd_help_t help)
         return TRUE;
     } else {
         index = atoi(args[0]);
-        if (index == 0) {
-            index = 9;
-        } else if (index != 10) {
-            index--;
-        }
     }
 
-    if (index == 0) {
-        cons_show("Cannot close console window.");
+    if (index < 0 || index == 10) {
+        cons_show("No such window exists.");
         return TRUE;
     }
 
-    if (index > 9 || index < 0) {
-        cons_show("No such window exists.");
+    if (index == 1) {
+        cons_show("Cannot close console window.");
         return TRUE;
     }
 
+    if (index == 0) {
+        index = 10;
+    }
+
     if (!ui_win_exists(index)) {
         cons_show("Window is not open.");
         return TRUE;
@@ -3055,11 +3054,7 @@ _cmd_close(gchar **args, struct cmd_help_t help)
 
     // close the window
     ui_close_win(index);
-    int ui_index = index + 1;
-    if (ui_index == 10) {
-        ui_index = 0;
-    }
-    cons_show("Closed window %d", ui_index);
+    cons_show("Closed window %d", index);
 
     return TRUE;
 }