On Wed, 15 Jan 2025 09:45:33 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> 
wrote:

> This manual test draws a "custom" Caret which is to be placed in the same 
> position between characters but it is seen the movement of caret leaves 
> artifacts. Custom caret is rendering 2 horizontal and 1 vertical line to 
> render "capital I" but horizontal lines repainting is not done properly.
> If the test is made to use Swing DefaultCaret implementation, no artifacts is 
> seen. Since the test is about placing of caret at same position between 
> characters, a plain vertical caret is sufficient to test so removed the 
> horizontal line rendering.  Also, added 1 extra pixel in repainting logic to 
> tackle caretWidth,height.
> Tested against windows, linux and mac where it renders ok and movement of 
> caret does not leave any artifacts.

Marked as reviewed by azvegint (Reviewer).

test/jdk/javax/swing/text/Caret/8163124/CaretFloatingPointAPITest.java line 226:

> 224:             g2d.draw(new Line2D.Float(c, cy, c, cy + ch));
> 225:             g2d.draw(new Line2D.Float(cx, cy, cx + cw, cy));
> 226:             g2d.draw(new Line2D.Float(cx, cy + ch, cx + cw, cy + ch));

>  Since the test is about placing of caret at same position between 
> characters, a plain vertical caret is sufficient to test so removed the 
> horizontal line rendering. 

I think we can still keep those lines, as it's kinda neat and presents a 
canonical caret look, and still works after applying the rest of the fix (I 
tried Linux and Windows).

-------------

PR Review: https://git.openjdk.org/jdk/pull/23129#pullrequestreview-2558914355
PR Review Comment: https://git.openjdk.org/jdk/pull/23129#discussion_r1920132498

Reply via email to