mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Applied ArrayPool pattern to GetDrawRegion method: - Use ArrayPool<string>.Shared.Rent() instead of .ToArray() for grapheme arrays - Track actual grapheme count separately from rented array length - Return array to pool in finally block for guaranteed cleanup - Handle rare case where array needs to grow during enumeration Impact: Eliminates allocations on layout calculations - GetDrawRegion called before drawing for text region calculations - Same allocation pattern as Draw() which was already fixed - Complements the Draw() optimization for complete text rendering pipeline All unit tests pass (12,055 parallelizable + 1,173 non-parallel) Co-authored-by: tig <585482+tig@users.noreply.github.com>