-
-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cursor disappears when adding space to full line #1112
Comments
Hi, and thanks for reporting. For your first issue, this is not a bug. The editor doesn't wrap lines ending in multiple spaces, so the cursor simply just moves out of the frame and under the text margin. All I can do is add an option that makes the editor window start scrolling horizontally to follow the cursor, which may actually be more user-friendly. The result is that the left margin of the text will be clipped instead. For your second point about the spaces being ignored by "Show tabs and spaces". This is intended behaviour, like it or not. This is done by the text rendering component of the editor widget on the Qt library side of things. I cannot change this behaviour on my end. It is the same underlying cause as in #1043. When the text is rendered on your screen, each line is made from a text box with a width defined by the width of the text without trailing spaces. Hence, added decoration to those spaces will not be rendered. I'll leave this open so that I can look into adding the auto-scrolling feature for the cursor. See also QTBUG-9742. |
Turns out the cursor is clipped in cases where the text (spaces or any other char) reaches exactly the right hand margin of the document editor. Since the cursor is positioned to the right of the edge, it disappears due to the document margin being set to zero. The margin visible in the editor is actually a margin of the viewport the document sits in, not the actual document. I've fixed the issue (I hope) by setting the document margin to the same value as the cursor's width, and subtract the same amount from the viewport margin. Now, the cursor will stop moving when it reaches the edge, and still be visible. It's too small a fix to do a patch release on 1.6.x, so I'm including it in the upcoming 1.7 release. |
Thanks a lot! I cloned the repo and it seems to work like a charm |
When a line in the document editor is full (adding another character would break the last word into a new line), it is possible for the text cursor to disappear, when one (or multiple) space is added at the end. To reproduce, just write a few words and hit space until the cursor vanishes.
Resizing the document editor doesn't help, but any non-space character will bring the cursor back. However, the spaces will still be ignored by the editor preference "Show tabs and spaces".
The text was updated successfully, but these errors were encountered: