about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-03-03 22:10:01 +0000
committerJames Booth <boothj5@gmail.com>2015-03-03 22:10:01 +0000
commit6be4b400b80d242538824d626297e1f70ed59b53 (patch)
treee604c55a018a6428f7a709140c418001ddf74694 /src
parent30b5f112fd81890411d6fe52c1f442f4433e0d01 (diff)
downloadprofani-tty-6be4b400b80d242538824d626297e1f70ed59b53.tar.gz
Fixed swapping windows when in source win
Diffstat (limited to 'src')
-rw-r--r--src/ui/windows.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ui/windows.c b/src/ui/windows.c
index dba5290c..b534e973 100644
--- a/src/ui/windows.c
+++ b/src/ui/windows.c
@@ -639,20 +639,21 @@ wins_swap(int source_win, int target_win)
 {
     ProfWin *source = g_hash_table_lookup(windows, GINT_TO_POINTER(source_win));
 
-    if (source != NULL) {
+    if (source) {
         ProfWin *target = g_hash_table_lookup(windows, GINT_TO_POINTER(target_win));
 
         // target window empty
-        if (target == NULL) {
+        if (!target) {
             g_hash_table_steal(windows, GINT_TO_POINTER(source_win));
-            status_bar_inactive(source_win);
             g_hash_table_insert(windows, GINT_TO_POINTER(target_win), source);
+            status_bar_inactive(source_win);
             if (win_unread(source) > 0) {
                 status_bar_new(target_win);
             } else {
                 status_bar_active(target_win);
             }
-            if ((wins_get_current_num() == source_win) || (wins_get_current_num() == target_win)) {
+            if (wins_get_current_num() == source_win) {
+                wins_set_current_by_num(target_win);
                 ui_switch_win(1);
             }
             return TRUE;