trstr: handle long patterns - neatvi - [fork] simple vi-type editor with UTF-8 support
 (HTM) git clone git://src.adamsgaard.dk/neatvi
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
       ---
 (DIR) commit 1a5dcfa46dc0770bfe79f8f3ef2e5990b1fe98b9
 (DIR) parent 5e4fe1565d620dc22c69a99cb8079a240930a60a
 (HTM) Author: Ali Gholami Rudi <ali@rudi.ir>
       Date:   Sun, 21 Nov 2021 01:37:42 +0330
       
       rstr: handle long patterns
       
       Diffstat:
         M rstr.c                              |       4 +++-
       
       1 file changed, 3 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/rstr.c b/rstr.c
       t@@ -71,7 +71,7 @@ static int match_case(char *s, char *r, int icase)
                        if (icase && tolower((unsigned char) *s) != tolower((unsigned char) *r))
                                return 1;
                }
       -        return 0;
       +        return *r;
        }
        
        /* return zero if an occurrence is found */
       t@@ -87,6 +87,8 @@ int rstr_find(struct rstr *rs, char *s, int n, int *grps, int flg)
                len = strlen(rs->str);
                beg = s;
                end = s + strlen(s) - len - 1;
       +        if (end < beg)
       +                end = beg;
                if (rs->lbeg)
                        end = beg;
                if (rs->lend)