Skip to content
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

Garbage is left from cursor on VK_DOWN #404

Closed
dzmipt opened this issue Sep 25, 2021 · 3 comments
Closed

Garbage is left from cursor on VK_DOWN #404

dzmipt opened this issue Sep 25, 2021 · 3 comments
Assignees
Labels
Milestone

Comments

@dzmipt
Copy link
Contributor

dzmipt commented Sep 25, 2021

I spot that during clicking on arrow down key, garbage is left on previous lines (see below screenshot from the Demo app). When I resize the frame (I assume during paint), the garbage disappears. VK_UP doesn't have such effect.
I am using MacOS 11.4; jdk1.8.0_251.jdk.
image

@bobbylight
Copy link
Owner

Can you debug and inspect the font being used (family, size, any other interesting tidbits?). I'm assuming it's the default (Menlo or Monaco or something similar) but just so I have the data point. This looks like a regression though I can't reproduce it. The fix is likely changing the caret height to be 1 pixel shorter.

Also, does the overwrite cursor do the same thing?

@bobbylight bobbylight self-assigned this Sep 25, 2021
@bobbylight bobbylight added the bug label Sep 25, 2021
@dzmipt
Copy link
Contributor Author

dzmipt commented Sep 25, 2021

textArea.getFont() returns
javax.swing.plaf.FontUIResource[family=Menlo,name=Menlo,style=plain,size=12]

Adding
textArea.setTextMode(RTextArea.OVERWRITE_MODE)
into the code will give me a block cursor. But the garbage is not left with such cursor

@dzmipt
Copy link
Contributor Author

dzmipt commented Sep 25, 2021

Changing ConfigurableCaret.java (lines 474-479) to this (decreasing caret height by one pixel) fixed the issue for me:
// A thicker vertical line.
case THICK_VERTICAL_LINE_STYLE:
g.drawLine(r.x,r.y+1, r.x,r.y+r.height);
r.x++;
g.drawLine(r.x,r.y+1, r.x,r.y+r.height);
break;

@bobbylight bobbylight added this to the 3.1.4 milestone Dec 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants