mirror of
https://github.com/lc-soft/LCUI.git
synced 2026-11-30 16:48:21 +01:00
Split lib/pandagl/src/text/text.c into four cohesive units backed
by a library-private header:
- text.c : type lifecycle, line storage, geometry,
dirty-rect bookkeeping, top-level update
- text_typeset.c : line breaking, merging, autowrap, alignment
- text_render.c : per-char bitmap refresh and drawing
- text_edit.c : caret, insert/delete/backspace, text I/O
- text_internal.h : library-private cross-file helpers
(not installed)
Drop the 'insert' overload that conflated 'cursor' with 'insertion
point' and align the field/API names with the cursor concept used
in mainstream GUI toolkits:
insert_x, insert_y -> caret.x, caret.y
(new pd_text_caret_t sub-struct)
pd_text_set_insert_position -> pd_text_set_caret
pd_text_set_insert_pixel_position -> pd_text_set_caret_pixel
pd_text_get_insert_pixel_position -> pd_text_get_caret_pixel
pd_text_get_char_pixel_position -> pd_text_get_char_pixel
Make text I/O symmetric and intent-revealing:
pd_text_dump -> pd_text_read
(mirrors pd_text_write)
pd_text_empty -> pd_text_clear
(the previous static helper
is renamed to pd_text_reset_lines)
pd_text_set_typeset_task -> pd_text_request_typeset
Add pd_text_to_wcs(text), which allocates and returns the full
buffer contents including line endings. It complements the
range-based pd_text_read for callers that just want the whole
text as a wide string.
Fix the mulitiline_enabled -> multiline_enabled typo while at it.
All call sites in lib/pandagl, src/widgets and the tests are
updated. test_text_edit.c gains two cases for pd_text_to_wcs
covering full-text round-trip and the empty-text edge case.