diff --git a/include/justui/jpainted.h b/include/justui/jpainted.h index d60bed4..5b545fe 100644 --- a/include/justui/jpainted.h +++ b/include/justui/jpainted.h @@ -31,7 +31,7 @@ an integer or a pointer (essentially). void draw_value(int x, int y, uint32_t *value) { - dprint(x, y, "%08X", *value); + dprint(x, y, "%08X", *value); } uint32_t my_value; jpainted *widget = jpainted_create(draw_value, &my_value, 30, 8, parent); diff --git a/src/jlabel.c b/src/jlabel.c index 1ffbfde..e6abbb9 100644 --- a/src/jlabel.c +++ b/src/jlabel.c @@ -28,6 +28,7 @@ jlabel *jlabel_create(char const *text, void *parent) l->color = C_BLACK; l->font = NULL; + l->wrap_mode = J_WRAP_NONE; l->text = text; l->owns_text = false; diff --git a/src/vec.c b/src/vec.c index 4b99b25..44e330b 100644 --- a/src/vec.c +++ b/src/vec.c @@ -24,21 +24,22 @@ bool vec_add(vec_t *v, size_t n) /* Allocate either size/2 new elements or 4 elements */ size_t ext = max(v->size / 2, 4); /* Make sure that no more than 255 free elements will remain */ - if(v->size + v->free + ext > n + 255) - ext = (n + 255) - (v->size + v->free); + if(v->free + ext > n + 255) + ext = (n + 255) - v->free; size_t newsize = v->size + v->free + ext; void *newdata = realloc(v->data, newsize * v->elsize); if(!newdata) return false; v->data = newdata; - v->free = newsize - n; + v->free = newsize - v->size - n; + v->size += n; } else { v->free -= n; + v->size += n; } - v->size += n; return true; }