# HG changeset patch
# User Olaf Wintermann <olaf.wintermann@gmail.com>
# Date 1706612291 -3600
# Node ID 3eb0cbab53dbf9380f65164f7a0a5130f2a60bb9
# Parent  26acbfa75c1f239ae2dc03eb6b28225aee175b17
don't change the path bar value if the new path is a prefix of the current path

diff -r 26acbfa75c1f -r 3eb0cbab53db application/davcontroller.c
--- a/application/davcontroller.c	Tue Jan 30 09:10:05 2024 +0100
+++ b/application/davcontroller.c	Tue Jan 30 11:58:11 2024 +0100
@@ -123,14 +123,19 @@
     if (len == 1 && *path == '/') {
         path = "";
     }
+    
+    // check if the new path is a prefix of the current path
+    // if not, we have to set the pathbar string to the new path
     char *full_path = util_concat_path(browser->repo_base, path);
-    // compare new path with current path
-    // in theory we could always set path, but maybe this is faster
+    char *full_path_col = util_concat_path(full_path, "/");
     char *current_path = ui_get(browser->path);
-    if (strcmp(full_path, current_path)) {
+    cxstring cpath = cx_str(current_path);
+    cxstring newc = cx_str(full_path_col);
+    if (!cx_strprefix(cpath, newc)) {
         ui_set(browser->path, full_path);
     }
     free(full_path);
+    free(full_path_col);
 
     DavBrowserQueryPath *query = malloc(sizeof(DavBrowserQueryPath));
     query->pool = browser->dav_queue;