Bug 137727 - [misc] Make text widget's left margin bigger
Summary: [misc] Make text widget's left margin bigger
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.1.2   Edit
Hardware: All All
: P3 enhancement with 1 vote (vote)
Target Milestone: 3.6 M4   Edit
Assignee: Dani Megert CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 56342
Blocks:
  Show dependency tree
 
Reported: 2006-04-20 10:14 EDT by Elliotte Rusty Harold CLA
Modified: 2009-11-02 09:46 EST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Elliotte Rusty Harold CLA 2006-04-20 10:14:11 EDT
I first noticed this problem in a 3rd party plugin editor (Oxygen). However it turns out to be a user interface problem in Eclipse's Java editor, its plain text editor, its Ant editor, and indeed every editor that uses the standard text pane. here it is:

It is extremely difficult to click the mouse in the proper position to place the cursor before the first character on a line.

This is not so noticeable in the Java editor because usually every line begins with one or two characters at least of white space, and consequently you rarely want to  put the cursor there. However, it's very noticeable when editing non-indented plain text or XML or HTML.

If you look at third party text editors such as BBEdit or even Microsoft Word you'll notice they have roughly an em's worth of white space in the left margin of the window where the text doesn't appear but where you can click the mouse to position the cursor at the beginning of the line. I didn;t realize how important this was until in Eclipse I didn't have it. I kept setting breakpoints or folding blocks, or doing whatever action was done by clicking in the left bar instead. 

I've only tested this on the Mac and Eclipse 3.1.2 but I suspect it's a cross-platform issue and probably occurs in 3.2 as well.
Comment 1 Steve Northover CLA 2006-04-20 12:41:06 EDT
Need to determine whether the problem is in StyledText or Text.
Comment 2 Silenio Quarti CLA 2006-04-26 17:18:32 EDT
This is not a Mac issue. Multiline StyledText has no left and write margins on all platforms.
Comment 3 Felipe Heidrich CLA 2006-04-27 11:56:45 EDT
the left and right margin have always been zero, the only case it is not zero is when bidi=true (because of the bidi caret).
Anyhow, to place the caret in the begging of the line you just need to click in the left half of the first charcters of the that line.
If I change this people will complain so I'll mark as duplicate of Bug 56342.

*** This bug has been marked as a duplicate of 56342 ***
Comment 4 Elliotte Rusty Harold CLA 2006-04-27 13:57:25 EDT
Clicking in the left of the first character is simply too difficult. Try clicking in the left half of an "i" sometime. This is why good text editors provide extra clickable margin by default. Possibly the component should not set a default margin. I'm not sure. However the specific instance of the styled text component used for Eclipse's java, plain text, and other editors absolutely should set a reasonable left margin by default. 

Thus this bug may depend on 56342, but I don't think it's the same thing. That bug says it should be possible to set a margin on a styled text component. This bug says that once 56342 is fixed, we should indeed set a left margin in the StyledText used for the Java and other editors. 
 
Comment 5 Felipe Heidrich CLA 2009-08-20 09:46:42 EDT
StyledText offers the support you need. Now it is up to Text Editors in Eclipse to allow the user to specify margins around the editor.
Comment 6 Markus Keller CLA 2009-09-03 08:41:41 EDT
Note that StyledText already has a 2px margin on the left in bidi mode (when an RTL keyboard language is installed). I would just always do 'styledText.setLeftMargin(2);' in AbstractTextEditor#createPartControl(..), which is a no-op for bidi systems but a great aid for others.
Comment 7 Markus Keller CLA 2009-10-09 14:50:49 EDT
I've been running my target with the following version of TextViewer#createTextWidget(..) for about a month now (mostly without the bidi caret), and I think we should just go ahead and release this now:

protected StyledText createTextWidget(Composite parent, int styles) {
	StyledText styledText= new StyledText(parent, styles);
	styledText.setLeftMargin(Math.max(styledText.getLeftMargin(), 2));
	return styledText;
}
Comment 8 Dani Megert CLA 2009-11-02 09:46:07 EST
Agree with comment 7.
Fixed in HEAD.
Available in builds > N20091101-2000.