Multi-line TextEditor Bug (?)

I have a multi-line text editor with word wrap enabled that can be used to enter text.

If I enter enough text to make the vertical scrollbar appear, then try to scroll UP (with mousewheel or scrollbar), the texteditor sort of glitches and refuses to scroll upwards.

This problematic behaviour goes away if setScrollToShowCursor() is set to false. However, in that case, as I enter new text I need to scroll to follow it manually.

The problem here is that I would like the texteditor to scroll DOWN automatically as new text is added. However, I would also like (and expect) to be able to scroll UP without needing to manually insert the caret at increasing ascending positions, in the same way any other texteditor on the planet works.

Is there any way to get this to work correctly? Is this a bug, or just an oversight in the implementation?

Have you tried any of the JUCE demo projects? For example, I think the MIDI Demo has a text editor that behaves in the way you expect. As MIDI is received, it is printed to a text editor which automatically scrolls to display the most recent message. Scrolling up in this textbox still works as expected, though.

Could you try out this demo and see whether it works for you on your system?

If this demo does work, then I suspect the problem is in your specific application. You could try sticking a breakpoint in TextEditor::scrollToMakeSureCursorIsVisible and inspect the call stack to see why the editor is trying to make the cursor visible.

Thank you. It does appear to be working correctly in the FontsDemo (where I can write text), so might not be a bug in JUCE. I’ll update if I find something that you may need to look at.