Bug 4866 - StyledText - Improve tab stops support in StyledText
Summary: StyledText - Improve tab stops support in StyledText
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P4 normal with 3 votes (vote)
Target Milestone: 3.6 M2   Edit
Assignee: Felipe Heidrich CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-11 14:24 EDT by Mike Wilson CLA
Modified: 2015-07-05 21:51 EDT (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Wilson CLA 2001-10-11 14:24:27 EDT
There have been requests in the eclipse.tools newsgroup for the ability to
	specify a set of tab stops for StyledText editor. Interestingly, the requests
	are actually from people writing *code* editors that want to support
	computer languages where the column that text occurs in is significant
	(as in Fortran, RPG, etc.)

NOTES:

	McQ (10/10/2001 2:17:57 PM) -
		Currently this is low priority.
Comment 1 Mike Wilson CLA 2002-05-24 19:33:05 EDT
Still low priority. Not for R2.0.
Comment 2 Mike Wilson CLA 2002-05-24 19:33:19 EDT
bugzilla!
Comment 3 Veronika Irvine CLA 2002-09-10 10:23:22 EDT
Post 2.0. Re-opening bug reports for review.
Comment 4 Lynne Kues CLA 2003-09-04 13:11:34 EDT
Reassigning to SWT Inbox since OTT taking over StyledText.
Comment 5 Nick Gravgaard CLA 2009-05-23 15:05:47 EDT
Are there any plans for anyone to do anything about this bug? The last comment was in 2003.

I would really like to see Eclipse be able to have non-uniform tabstops on different lines.
Comment 6 Felipe Heidrich CLA 2009-05-26 15:15:38 EDT
(In reply to comment #5)
> Are there any plans for anyone to do anything about this bug? The last comment
> was in 2003.
> I would really like to see Eclipse be able to have non-uniform tabstops on
> different lines.


No plans, we are already done for 3.5.
Feel free to contribute a fix for 3.6. 
See TextLayout#setTabs(int[]), StyledText already uses TextLayout.
Comment 7 Felipe Heidrich CLA 2009-06-08 10:02:42 EDT
*** Bug 279356 has been marked as a duplicate of this bug. ***
Comment 8 Nick Gravgaard CLA 2009-06-08 14:53:46 EDT
(In reply to comment #7)
> *** Bug 279356 has been marked as a duplicate of this bug. ***

Since I'm not the original reporter of this bug, it is not clear to me what "Support for tab stops" means.

Firstly, presumably Eclipse/SWT has always had normal fixed tabstops, so it can't mean that.

Secondly there's TextLayout#setTabs(int[]) (as you mentioned), which already exists.

Thirdly there's what I'm looking for -  non-uniform tabstops on different lines. 

If this third option is what this bug is really about, can we rename this bug to avoid further confusion? Otherwise, could we "un-duplicate" Bug 279356?
Comment 9 Felipe Heidrich CLA 2009-06-08 15:13:48 EDT
(In reply to comment #8)
> If this third option is what this bug is really about, can we rename this bug
> to avoid further confusion? Otherwise, could we "un-duplicate" Bug 279356?

I prefer to keep all the effort in this area in one bug. So I'm changing the title to be more generic.
Comment 10 Markus Fischer CLA 2009-09-03 14:08:43 EDT
Unfortunately I lack the skills to contribute code :( However I've followed Nicks "elastic tabstops" efforts ever since and it would really be interesting to see support coming for this in one of the major open source software development tools on this planet ... +1 voted.
Comment 11 Felipe Heidrich CLA 2009-09-03 14:19:38 EDT
This should not be too bad. TextLayout already has support for tab stops.
See StyledTextRenderer#getTextLayout where the styledtext sets the tab width in the text layout. Probably all you need to do is to set a array with the tab stops in the text layout (instead of the constant tab width currently used).

I'll try to make time to fix for 3.6.
Comment 12 Nick Gravgaard CLA 2009-09-06 11:18:32 EDT
(In reply to comment #11)
> This should not be too bad. TextLayout already has support for tab stops.
> See StyledTextRenderer#getTextLayout where the styledtext sets the tab width in
> the text layout. Probably all you need to do is to set a array with the tab
> stops in the text layout (instead of the constant tab width currently used).
> 
> I'll try to make time to fix for 3.6.

Do you think it will be possible to define the widths of the tabstops in pixels rather than the number of monospaced characters?
Comment 13 Felipe Heidrich CLA 2009-09-09 16:09:09 EDT
Fixed in HEAD > 20090909

See:
StyledText#setTabStops(int[])
StyledText#getTabStops()
Comment 14 Felipe Heidrich CLA 2009-09-10 16:04:31 EDT
I fixed up the testcase I wrote while testing the feature and released it as snippet:

http://www.eclipse.org/swt/snippets/index.php#StyledText
◦variable tab stops in StyledText

Direct link:
http://dev.eclipse.org/viewcvs/index.cgi/~checkout~/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet325.java
(it should be up in a few minutes)
Comment 15 Felipe Heidrich CLA 2010-03-11 15:23:17 EST
Note:

I had to rename StyledText#getTabsStop() to StyledText#getTabStops() as it was spell incorrectly.
I'm very sorry for the inconvenience, but unfortunately we only detected it today and the API freeze is tomorrow.

This change will in Eclipse 3.6 M6