RichTextFX: Caret Position = InlineCssTextArea .getText().length() but it doesn't scroll vertically to the bottom
-
Java Version: jdk1.8.0_112
-
RichTextFX Version: richtextfx-fat-0.6.10.jar
I am using :
InlineCssTextArea textArea = new InlineCssTextArea();
textArea.setEditable(false);
textArea.setFocusTraversable(false);
and i am trying to scroll programmatically at the bottom :
//It returns the maximum length of the InlineCssTextArea `text`
System.out.println(textArea.getText().length());
System.out.println(textArea.getCaretPosition());
//It doesn't scroll to the end
textArea.positionCaret(textArea.getText().length());
The problem is that the length of InlineCssTextArea text is 830 even if the caret is positioned at 830 it doesn’t scroll to the bottom…

Is it a bug?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 16 (10 by maintainers)
So the issue is maybe done … 😃
Also, I exposed more API in #418 that can accomplish what you desire with
show-related methods. For example:However, we haven’t made a new release with that code yet.
Try this code. I noticed that when
wrapTextis false, the virtualflow will scroll to the second-to-last line. I’m not entirely sure why that occurs, but it might be due to that line having no content on it. Regardless, whenwrapTextis true, it works as expected. (I also made the area editable and request focus after the stage is shown, so one can see the position of the caret).In the 0.7-M3 release, you’ll use the code:
Are you using
positionCaretintentionally? The right way to move the caret is viamoveTo(I don’t know if that will fix your problem).