Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 125220 - Tab char position miscalculated in Java editor
Summary: Tab char position miscalculated in Java editor
Status: RESOLVED DUPLICATE of bug 123425
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.2   Edit
Hardware: PC Linux-GTK
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Felipe Heidrich CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-25 14:02 EST by Frits Jalvingh CLA
Modified: 2006-02-16 12:26 EST (History)
2 users (show)

See Also:


Attachments
Picture of a text selection rendered badly (9.10 KB, image/png)
2006-01-29 10:05 EST, Frits Jalvingh CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Frits Jalvingh CLA 2006-01-25 14:02:40 EST
I use tabs for indent (not spaces) in the Java editor. In many cases the "next tab position" will be miscalculated: instead of moving to the actual new position the text moves only about a single pixel. It looks like the string length calculation calculates a pixel size that's one too small. If I use a space instead of a tab then the cursor does advance proper. An example as it looks on the screen:

private Mama<String> m_blarf;
private List<String>m_attr_l;

The first line contains the space just before the m_; the second one contains the tab which should move way beyond the start position of the m_blarf text.

This bug is visible on both x86-gtk and amd64-gtk, and it occurs on most Eclipse versions. My editor font is Bistream Vera Mono; I'm running Gentoo Linux with X 6.8.2-r6, freetype 2.1.9-r1, pango 1.10.2 (I have no idea what other stuff is used to render the text ;-)
Comment 1 Frits Jalvingh CLA 2006-01-25 14:10:31 EST
Some extra info:
- It goes wrong on Bitstream Vera Mono 10pt but it goes well on some other sizes
- Fonts that also fail on 10pt are Nimbus Mono L and Monospace
- Fonts that work well at 10pt are Luxi Mono, Terminal and Lucida Typewriter.
My screen resolution as reported by xdpyinfo is:
  dimensions:    1600x1200 pixels (411x311 millimeters)
  resolution:    99x98 dots per inch
Comment 2 Dani Megert CLA 2006-01-26 03:07:26 EST
What's the build ID of your Eclipse install?
Comment 3 Frits Jalvingh CLA 2006-01-29 10:04:52 EST
My eclipse build is: Version: 3.1.1
Build id: M20050929-0840
but again: it is in the newer versions too.

And a "fix" for my previous comment: the fonts I described as not having the problem *do* have the problem, only at different positions.. That is some tabs behave properly while others do not, and which tabs misbehave depends on the font..
I will also attach an image of how selecting a text region looks on my screen: it leaves bars at the end of characters which may point to the same problem (calculating string widths seems to be off by 1 pixel).
Comment 4 Frits Jalvingh CLA 2006-01-29 10:05:54 EST
Created attachment 33766 [details]
Picture of a text selection rendered badly
Comment 5 Felipe Heidrich CLA 2006-02-16 12:26:43 EST

*** This bug has been marked as a duplicate of 123425 ***