]> git.xolatile.top Git - public-libhl.git/commitdiff
almost...
authoranon <anon@anon.anon>
Wed, 20 Sep 2023 21:37:07 +0000 (23:37 +0200)
committeranon <anon@anon.anon>
Wed, 20 Sep 2023 21:37:07 +0000 (23:37 +0200)
source/hl.c

index 8d933538efc5f7542bcaedf3f5da5673ee55f9c2..5c415d9e1af8981fed8aeced71fc33dca9ace82e 100644 (file)
@@ -220,6 +220,9 @@ void render_string(const char * const string,
                token_t * t = *(token_t**)vector_get(&token_table,
                                                     i);
                match_t * match = regex_match(t->syntax, string, true);
+               for(match_t * m = match; m->position != -1; m++){
+                       printf("%s: %d %d\n", t->syntax->str, m->position, m->width);
+               }
                if (match->position == -1) {
                        free(match);
                        continue;
@@ -248,16 +251,17 @@ void render_string(const char * const string,
                        }
                }
                if (max != &sentinel) {
-                       const int padding = max->m[max->i].position - (s - string);
+                       const match_t * mymatch = &(max->m[max->i]);
+                       const int padding = mymatch->position - (s - string);
                        if (padding) {
                                display->callback(s,
                                                                  padding,
                                                                  NULL);
                        }
                        display->callback(s + padding,
-                                                         max->m->width,
+                                                         mymatch->width,
                                                          max->t->hl->attributes);
-                       s += padding + max->m->width;
+                       s += padding + mymatch->width;
                } else {
                        display->callback(s, 1, NULL);
                        ++s;