PreviousNextTracker indexSee it online !

(3/231) 1170140 - autoIndent aligns with javadoc *

If I'm typing a Java file, and I enter a Javadoc,
followed by a class or method declaration, when I press
<enter> on the line, it indents to the * on the
javadoc. Example:

I type:
<pre>
/**
* javadoc comment
*/
public class MyClass {
</pre>


Jedit automatically indents to:
<pre>
/**
* javadoc comment
*/
public class MyClass {
</pre>


inserting the space at the beginning of the line. This
is quite annoying.

Workaround:
comment out these two lines
<pre>
&lt;PROPERTY NAME="indentOpenBrackets" VALUE="{" /&gt;
&lt;PROPERTY NAME="indentCloseBrackets" VALUE="}" /&gt;
</pre>

in the java mode file. However, this disables the other
features of autoindent.

Dusty

Submitted sawdusty - 2005-03-24 - 20:37:37z Assigned kog13
Priority 5 Category editor core
Status Open Group minor bug
Resolution None Visibility No

Comments

2007-02-08 - 20:33:09z
rschwenn
Logged In: YES
user_id=1486645
Originator: NO

I can't see what You mean.
I guess the text You typed has been re-formatted and has become unclear. HTML tags are not recognized here in the tracker.
2007-02-08 - 21:01:12z
rschwenn
Logged In: YES
user_id=1486645
Originator: NO

Now, that I got this tracker item via Mail, there are some leading spaces to see:

Original, there was leading spaces only before the javadoc. "public class MyClass " was typed without any leading spaces. But at the time I type "{" this line is indented like the preceeding javadoc. It's not expected, is it?.

jEdit 4.2final and 4.3pre9
java 1.5.0_10
Windows XP SP2
2010-11-15 - 22:23:15z
kog13
This is an old bug, but one that I've also run into and am not sure how to classify. Technically speaking, it's not a bug; the indentation of each line is determined by that of the line before it, which results in the space being preserved.

As far as I can tell, the only way to really fix this would be to change the indent behavior, by either forcing an alignment or by adding special support for comment headers. This might be a little difficult to do, though I'll probably look into it soon.

Attachments