Textarea - Remove characters in the front

I’m implementing a sort of console like widget with the use of lv.textarea and os,dupterm.
Messages are coming in and are being added to the textarea with add_text().
When the text gets to large, I remove a couple of lines and re-populate the complete textarea with set_text().

Now I’ve noticed that set_text() takes a bit more time when compared to the add_text() instructions.

Is there a add_text() alternative to efficiently remove a given number of characters from the beginning of the texteara, preferably without affecting the scroll position.

Example code:

Did you try to manipulate the label directly?

Use get_label to get the label object from the textarea, then use the label’s set_text or cut_text, etc.
You might need to invalidate the textarea or send some lv.EVENT.VALUE_CHANGED event after modifying the label, I’m not sure.

1 Like

Awesome, Label cut_text() is exactly what I was looking for. :grinning: