From: Mike Lowis Date: Thu, 18 May 2023 20:45:51 +0000 (-0400) Subject: undo change from left-most to right-most match. Need to consider this more carefully X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=416c06d3f532aff711b0fe75e839c157eddfd72e;p=proto%2Faos.git undo change from left-most to right-most match. Need to consider this more carefully --- diff --git a/bin/pick.c b/bin/pick.c index f710170..eab307b 100644 --- a/bin/pick.c +++ b/bin/pick.c @@ -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 */