How to create a Editable box (multiline) with characters and lines limitation?

Hi,

I am trying to make a simple text box multilined where the player can write whatever he wants. That box emulates a page in a book / diary, so when the player reaches the bottom-right corner, it stops writing.

I tried with counting characters, but it does not work for what I want, because the player can enter newlines: \n, and that lines don’t count as characters.

So, just want a simple editable text box, with border limitations. I don’t want vertical or horizontal scrolling, just a simple box. Thanks in advance.