]> git.mdlowis.com Git - proto/aos.git/commitdiff
undo change from left-most to right-most match. Need to consider this more carefully
authorMike Lowis <mike.lowis@gentex.com>
Thu, 18 May 2023 20:45:51 +0000 (16:45 -0400)
committerMike Lowis <mike.lowis@gentex.com>
Thu, 18 May 2023 20:45:51 +0000 (16:45 -0400)
bin/pick.c

index f710170adbfc8dd688ee8eb760bc05e72e98865a..eab307b9555b2a1cc923318f76d21f383952a71b 100644 (file)
@@ -139,8 +139,8 @@ static bool match(char *string, size_t offset, size_t *start, size_t *end)
         return false;
     s2 = s1, e2 = e1; // Init s2 and e2 before use below
 
-    /* next find the longest match. If multiple, take the right most one */
-    while (find_match(string, Query, ++offset, &s1, &e1) && ((e1-s1) >= (e2-s2)))
+    /* next find the longest match. If multiple, take the left most one */
+    while (find_match(string, Query, ++offset, &s1, &e1) && ((e1-s1) <= (e2-s2)))
         s1 = s2, e1 = e2;
 
     /* return the best match */