RSyntaxTextArea
RSyntaxTextArea copied to clipboard
Invisible last line on wrapped lines with text becoming unworkable
Version: RSyntaxTextArea 3.1.3
I use long lines in RSTA and enabled line wrapping at word boundaries. At some times, when RSTA is set with text, the last line of the wrapped line becomes invisible upon positioning the cursor in one of the previous lines of that wrapped line.
Here's how to reproduce it with a minimal example (attached):
- run the program (the text is set and wrapped over 4 lines, cursor is set at the end)
- click a line except the last one to reposition the cursor
- the last line becomes invisble
- try to select part of the text by mouse
- try to move the cursor up and down the lines with the arrow keys and see various lines disappear and reappear
- type a character into the text area or resize the window horizontally (!) and see it suddenly behave correctly (the horizontal resize needs to move words around to make it work)
You probably have to restart the program multiple times. The issue does not always show with the example. It appears to be random. In our software where I actually use it, it happens always.
And it only affects RSyntaxTextArea. RTextArea works fine.
Example program: TextAreaTest.txt

I discovered a workaround. After setText() I change the font size and then set the old font again:
textArea.setText(code);
Font oldFont = textArea.getFont();
textArea.setFont(new Font(..., ..., oldFont.getSize() - 1));
textArea.setFont(oldFont);
That might help in locating the error.