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

Bug 118612

Summary: [StyledText] How to set caret size in variableHeight StyledText
Product: [Eclipse Project] Platform Reporter: Dani Megert <daniel_megert>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WORKSFORME QA Contact: Felipe Heidrich <eclipse.felipe>
Severity: normal    
Priority: P3 CC: azerr, mistria
Version: 3.2Keywords: triaged
Target Milestone: ---   
Hardware: All   
OS: All   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=532173
Whiteboard:

Description Dani Megert CLA 2005-11-30 06:08:01 EST
I20051129-0800

We have code that creates custom carets (by using an image and by setting the size). So far we could use getLineHeight() to compute the height of the caret. How will such a carets behave in multi-font scenario?
Comment 1 Dani Megert CLA 2005-11-30 06:23:35 EST
How does the default caret behave?
Comment 2 Felipe Heidrich CLA 2005-11-30 17:29:47 EST
Right now it uses getLineHeight(int offset).
There is no support in TextLayout to retreive the ink rect of a characters.
We plan to have a better support for it in the future.
Comment 3 Dani Megert CLA 2005-12-01 03:46:27 EST
>Right now it uses getLineHeight(int offset).
This means the caret changes per line when I move up/down?
Comment 4 Dani Megert CLA 2005-12-05 06:14:25 EST
>This means the caret changes per line when I move up/down?
yes.
Comment 5 Dani Megert CLA 2005-12-05 06:17:35 EST
We either need the ability to specify auto-resizing of the caret (image) or a callback so that we can update the caret ourselves.
Comment 6 Steve Northover CLA 2005-12-07 17:13:47 EST
Won't be looking at this until FH gets back.
Comment 7 Dani Megert CLA 2005-12-08 02:57:24 EST
That's OK.
Comment 8 Felipe Heidrich CLA 2009-08-19 16:01:52 EDT
Your bug has been moved to triage, visit http://www.eclipse.org/swt/triage.php for more info.
Comment 9 Leo Ufimtsev CLA 2017-08-03 12:30:02 EDT
This is a one-off bulk update. (The last one in the triage migration).

Moving bugs from swt-triaged@eclipse to platform-swt-inbox@eclipse.org and adding "triaged" keyword as per new triage process:
https://wiki.eclipse.org/SWT/Devel/Triage

See Bug 518478 for details.

Tag for notification/mail filters:
@TriageBulkUpdate
Comment 10 Mickael Istria CLA 2018-03-09 11:16:09 EST
This is an issue for the AbstractTextEditor which is by default configured to use custom think caret according to the preference.
Comment 11 Mickael Istria CLA 2018-03-12 08:43:08 EDT
In a multi-font scenario, I believe you should use a caret listener to dynamically change the size of your cursor according to its position.
@Dani: Is this enough to close this bug?
Comment 12 Mickael Istria CLA 2018-03-12 18:02:36 EDT
I'm closing this one. I believe a combination of a custom caret and a CaretListener can already cover the requirements of the initial request.
The only missing piece would be to make method StyledText.getBoundsAtOffset more visible to allow to get good hint about the height at given offset, but if one has the font, using the font height can be enough.