Skip to content

listbase: Don't skip initial cursor position

We have built-in keybindings for cursor arrow keys. They move the focus in the pointed direction and may also select the new focus child.

This is usually what we want, except in the initial state, before any focus child has been set. In such case, we want to move focus into the initial focus child. This was the behavior of GtkTreeView, as can be tested in GTK Demo -> Tree View -> Tree Store.

Unfortunately, we've been skipping the initial focus and moving the cursor straight into the next child. At best, this means we need to take an a extra step to move the cursor into the first child. At worst, if there is only one child, the cursor arrow keys don't work at all and the only way to reach the child is with the Tab key or a pointer.

In order to get the expected result, check whether the child at the position reported by the focus item tracker is already our focus child and, if not, move cursor into it, rather than away from it.

Fixes nautilus#2618 and nautilus#3078

Merge request reports