diff options
Diffstat (limited to 'src/tab.c')
-rw-r--r-- | src/tab.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -375,3 +375,25 @@ mq_tab_update_position(MqTab *tab, guint position) tab->position = position; update_tab_label(tab); } + +MqTab * +mq_tab_seek(MqTab *node, guint position) +{ + /* Skip forward to the containing subtree. */ + while (node && node->position + node->tree_size <= position) { + node->next; + } + + /* Check whether we've gone past the end of the tree. */ + if (!node) { + return NULL; + } + + /* Check whether the sibling we've reached is the node we want. */ + if (node->position == position) { + return node; + } + + /* Recurse down the subtree. */ + return mq_tab_seek(node->first_child, position); +} |