Function for setting placeholder text on textarea to a static string

I’m using some large static text arrays for my text to make localizations easier. I’m though missing this function for the textarea placeholder text.


I thought placeholder texts are usually short and there is no benefit for a static placeholder.

How long is your placeholder text?

It is not as much the length as it is the fact that I don’t like a lot of mallocs when switching language. As I’m running on freertos defragmentation of memory is a concern.

On that note it might actually also be an advantage if it was possible to make the textarea work on a predefined array insted of constantly running realloc.

Using a text area will make a lot of mallocs any way. Every time the text area changes there is at least one memory allocation. During rendering there also a lot of allocations for “helper buffer”.

I suggest measuring how many times malloc/realloc is called. I believe there will be a lot of calls. Compared to it I think the rare reallocations of the placeholder is negligible.