Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.6.2, 5.7.0
-
None
Description
If you have a QTextEdit control that's too short to contain a single line of the text that is being edited, then the editor will alternate between scrolling to the top and to the bottom of the document whenever text is entered or whenever the caret is repositioned with the mouse.
You can reproduce this easily with the attached application: just type in to the text edit (set to 72pt Times New Roman) and you'll see the problem.
"Why would you do that?" I hear you cry. Well, in our application, the editor size is determined by the user adjusting the frame the text is in, and some CJK fonts have a very large line height, meaning that the user may have adjusted the frame (with border) to fit the text visually but the editor may still be too small for a full line's height. This is the case that was reported to us by a user, anyway.
I think the bug is in QTextEditPrivate::_q_ensureVisible; in this case, rect.t() == verticalOffset(), and this incorrectly goes in to the else construct in the conditional at the end. This case should probably just not reposition.