Bugfix: Insert new containers at the right position (and add testcase)
This commit is contained in:
@ -58,7 +58,14 @@ Con *con_new(Con *parent) {
|
||||
|
||||
void con_attach(Con *con, Con *parent) {
|
||||
con->parent = parent;
|
||||
TAILQ_INSERT_TAIL(&(parent->nodes_head), con, nodes);
|
||||
Con *current = TAILQ_FIRST(&(parent->focus_head));
|
||||
|
||||
if (current == TAILQ_END(&(parent->focus_head)))
|
||||
TAILQ_INSERT_TAIL(&(parent->nodes_head), con, nodes);
|
||||
else {
|
||||
DLOG("inserting after\n");
|
||||
TAILQ_INSERT_AFTER(&(parent->nodes_head), current, con, nodes);
|
||||
}
|
||||
/* We insert to the TAIL because con_focus() will correct this.
|
||||
* This way, we have the option to insert Cons without having
|
||||
* to focus them. */
|
||||
|
Reference in New Issue
Block a user