same fix, but for moving (search above the current con when moving is not possible in this direction)
This commit is contained in:
parent
86500c5b88
commit
c5ab16c00d
20
src/move.c
20
src/move.c
|
@ -87,6 +87,10 @@ void tree_move(int direction) {
|
|||
orientation_t o = (direction == TOK_LEFT || direction == TOK_RIGHT ? HORIZ : VERT);
|
||||
|
||||
Con *same_orientation = con_parent_with_orientation(con, o);
|
||||
/* The do {} while is used to 'restart' at this point with a different
|
||||
* same_orientation, see the very last lines before the end of this block
|
||||
* */
|
||||
do {
|
||||
/* There is no parent container with the same orientation */
|
||||
if (!same_orientation) {
|
||||
if (con_is_floating(con)) {
|
||||
|
@ -109,11 +113,9 @@ void tree_move(int direction) {
|
|||
if (same_orientation == con->parent) {
|
||||
DLOG("We are in the same container\n");
|
||||
Con *swap;
|
||||
if (!(swap = (direction == TOK_LEFT || direction == TOK_UP ?
|
||||
if ((swap = (direction == TOK_LEFT || direction == TOK_UP ?
|
||||
TAILQ_PREV(con, nodes_head, nodes) :
|
||||
TAILQ_NEXT(con, nodes))))
|
||||
return;
|
||||
|
||||
TAILQ_NEXT(con, nodes)))) {
|
||||
if (!con_is_leaf(swap)) {
|
||||
insert_con_into(con, con_descend_focused(swap), AFTER);
|
||||
goto end;
|
||||
|
@ -129,6 +131,16 @@ void tree_move(int direction) {
|
|||
return;
|
||||
}
|
||||
|
||||
/* If there was no con with which we could swap the current one, search
|
||||
* again, but starting one level higher. If we are on the workspace
|
||||
* level, don’t do that. The result would be a force change of
|
||||
* workspace orientation, which is not necessary. */
|
||||
if (con->parent == con_get_workspace(con))
|
||||
return;
|
||||
same_orientation = con_parent_with_orientation(con->parent, o);
|
||||
}
|
||||
} while (same_orientation == NULL);
|
||||
|
||||
/* this time, we have to move to another container */
|
||||
/* This is the container *above* 'con' which is inside 'same_orientation' */
|
||||
Con *above = con;
|
||||
|
|
Loading…
Reference in New Issue