aboutsummaryrefslogtreecommitdiff
path: root/src/con.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/con.c')
-rw-r--r--src/con.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/con.c b/src/con.c
index 917e797a..abcc4fba 100644
--- a/src/con.c
+++ b/src/con.c
@@ -116,14 +116,14 @@ static void _con_attach(Con *con, Con *parent, Con *previous, bool ignore_focus)
/* we need to insert the container at the beginning */
TAILQ_INSERT_HEAD(nodes_head, con, nodes);
} else {
- while (current->num != -1 && con->num > current->num) {
+ while (current->num != -1 && con->num >= current->num) {
current = TAILQ_NEXT(current, nodes);
if (current == TAILQ_END(nodes_head)) {
current = NULL;
break;
}
}
- /* we need to insert con after current, if current is not NULL */
+ /* we need to insert con before current, if current is not NULL */
if (current) {
TAILQ_INSERT_BEFORE(current, con, nodes);
} else {