Anuken/Arc

TextArea crashes with a non-default font

Mnemotechnician opened this issue · 1 comments

Creating a TextFieldStyle with a custom font and applying it to a TextArea causes very bizzare behaviour:

  • When the cursor is on the first line, everything is ok
  • When it is not, the following happens:
    • The cursor is always rendered in the very left
    • Any inputted text is added after the cursor and the left/right arrow keys are ignored
    • An attempt to move the cursor by touching the text area outside the first line or by pressing the up/down arrow buttons causes an AIOOBException in many different functions (i tried to create a subclass of TextArea and override them, but every time i did an exception popped in a different place).

The style is defined like this (mono is a custom font, but the same happens if you use Fonts.tech or anything else other than Fonts.def):

CStyles.monoArea = new TextFieldStyle(Styles.defaultField) {{
        font = mono;
        messageFont = mono;
}};

and the text area was added to a table like this:

input.area("", CStyles.monoArea, (text) -> { /* ... */ })

The first crash log: crash_1660389403160.txt (this is from v136.1, but these classes haven't been changed during the past 6 months)

TextArea gets broken in all sorts of funny ways regardless of font when you do a number of things - for instance, setting width/height too small.

Frankly, I have absolutely no interest in fixing any of this, so if you care, figure it out and submit a PR yourself. I didn't even write that class.