<p><b>@kugel-</b> commented on this pull request.</p>

<hr>

<p>In <a href="https://github.com/geany/geany/pull/1813#discussion_r308452479">src/sidebar.c</a>:</p>
<pre style='color:#555'>> +                    break;
+               }
+               case TREE_CASE_CHLID_OF:
+               {
+                       /* This dir is longer than existing so just add child */
+                       tree_add_new_dir(parent, &data.best_iter, path);
+                       break;
+               }
+               case TREE_CASE_PARENT_OF:
+               {
+                       /* More complicated logic. This dir should be a parent
+                        * of existing, so reparent existing dir.  */
+                       has_parent = gtk_tree_model_iter_parent(model, &iter, &data.best_iter);
+                       tree_add_new_dir(parent, has_parent ? &iter : NULL, path);
+                       tree_copy_recursive(&data.best_iter, parent);
+                       gtk_tree_store_remove(store_openfiles, &data.best_iter);
</pre>
<p>Looking at this, your suggestion sounds good and would also make the intent of the function more clear.</p>
<p>The copy is currently mainly done because the shortname of a directory node may change (if a new parent is added in-between then child nodes could change from a/b/c/d to a->b/c/d, for example (after opening a/x.c))</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/geany/geany/pull/1813?email_source=notifications&email_token=AAIOWJ2CLMNANRXIA5N5M6LQB5QUFA5CNFSM4EWIWKT2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB75EGYA#discussion_r308452479">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAIOWJ3F2FNWLZ7KIUIE4STQB5QUFANCNFSM4EWIWKTQ">mute the thread</a>.<img src="https://github.com/notifications/beacon/AAIOWJ6YPICU2QIRX6QAZELQB5QUFA5CNFSM4EWIWKT2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB75EGYA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/geany/geany/pull/1813?email_source=notifications\u0026email_token=AAIOWJ2CLMNANRXIA5N5M6LQB5QUFA5CNFSM4EWIWKT2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB75EGYA#discussion_r308452479",
"url": "https://github.com/geany/geany/pull/1813?email_source=notifications\u0026email_token=AAIOWJ2CLMNANRXIA5N5M6LQB5QUFA5CNFSM4EWIWKT2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB75EGYA#discussion_r308452479",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>