Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 357710

Summary: Text#getCaretLocation() not implemented for SINGLE style
Product: [Eclipse Project] Platform Reporter: Markus Keller <markus.kell.r>
Component: SWTAssignee: George Cheng <y29cheng>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: eclipse.felipe, eclipse, eclipse, lshanmug, Silenio_Quarti, y29cheng
Version: 3.8   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X   
Whiteboard: stalebug

Description Markus Keller CLA 2011-09-14 20:02:08 EDT
HEAD

Text#getCaretLocation() is not implemented for SINGLE style Texts. It always returns {0, 0}.

Furthermore, the Javadoc of the method doesn't make sense. It should tell that the location is relative to this Text.
Comment 1 Felipe Heidrich CLA 2011-09-15 10:09:36 EDT
Silenio, do you know if this be fixed ?

maybe Lakshmi can investigate this...
Comment 2 Felipe Heidrich CLA 2011-09-15 10:18:50 EDT
I fixed the doc
http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=33702c0f14302d7231ea3f607b86a900e03829aa
Thank you for pointing that out, it has being wrong for ages. It looks like someone copied the javadoc from Control#getLocation() but didn't change the text propertly...
Comment 3 Silenio Quarti CLA 2011-09-20 18:00:19 EDT
George is fixing bug#44072. He will fix this one too.
Comment 4 George Cheng CLA 2011-09-21 09:26:11 EDT
(In reply to comment #3)
> George is fixing bug#44072. He will fix this one too.

The fix is included in the patch for Bug 44072.
Comment 5 Doug M CLA 2011-10-20 18:29:58 EDT
Just downloaded this week's 4.2 Stream Maintenance build. It's not fixed. But a TODO note has been added to fix.

Please SWT wizards - this deficiency is holding up my project.

While you are at it, the corresponding setCaretLocation is missing. You can get the equivalent in StyledText with setCaretOffset(getCaretOffset(point)). But there's no way to set the caret location for Text.
Comment 6 Doug M CLA 2011-10-20 18:37:47 EDT
(In reply to comment #5)
> Just downloaded this week's 4.2 Stream Maintenance build. It's not fixed. But a
> TODO note has been added to fix.
> 
> Please SWT wizards - this deficiency is holding up my project.
> 
> While you are at it, the corresponding setCaretLocation is missing. You can get
> the equivalent in StyledText with setCaretOffset(getCaretOffset(point)). But
> there's no way to set the caret location for Text.

Whoops that should be getOffsetAtLocation(point).
Comment 7 Lars Vogel CLA 2019-11-14 03:42:15 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

If the bug is still relevant, please remove the "stalebug" whiteboard tag.