diff --git a/include/QF/ui/passage.h b/include/QF/ui/passage.h index 09a47b9ee..060c09948 100644 --- a/include/QF/ui/passage.h +++ b/include/QF/ui/passage.h @@ -35,6 +35,12 @@ */ ///@{ +enum { + passage_type_text_obj, + + passage_type_count +}; + typedef struct psg_text_s { /// beginning of text for this segment relative to passage_t.text uint32_t text; diff --git a/libs/ui/passage.c b/libs/ui/passage.c index fd112c56e..0157ee754 100644 --- a/libs/ui/passage.c +++ b/libs/ui/passage.c @@ -44,12 +44,6 @@ #include "QF/ui/passage.h" #include "QF/ui/view.h" -enum { - passage_type_text_obj, - - passage_type_count -}; - static const component_t passage_components[passage_type_count] = { [passage_type_text_obj] = { .size = sizeof (psg_text_t), @@ -112,6 +106,7 @@ Passage_ParseText (passage_t *passage, const char *text) unsigned num_paragraphs = 1; unsigned num_text_objects = 1; + psg_text_t root_text = {}; int parsing_space = Passage_IsSpace (text); for (const char *c = text; *c; c++) { int size; @@ -132,6 +127,7 @@ Passage_ParseText (passage_t *passage, const char *text) } parsing_space = 0; } + root_text.size = c - text; } passage->hierarchy = Hierarchy_New (passage->reg, &passage_type, 0); Hierarchy_Reserve (passage->hierarchy, @@ -152,6 +148,7 @@ Passage_ParseText (passage_t *passage, const char *text) psg_text_t *text_obj = &passage_obj[h->childIndex[1]]; *par_obj = *text_obj = (psg_text_t) { }; + *passage_obj = root_text; add_entity (passage->hierarchy, par_obj - passage_obj); parsing_space = Passage_IsSpace (text);