NextTracker indexSee it online !

(1/240) 2365 - 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 nobody - 2005-03-24 20:37:37 Assigned kog13
Priority 5 Labels editor core
Status open Group minor bug
Resolution None

Comments

2007-02-08 20:33:09
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:12
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:15
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.

2012-01-18 01:43:54
ezust

- **assigned_to**: nobody --> kog13

2017-12-02 21:42:39.996000
tsourick

The example is unclear.
If the space is inserted on the next line after opening bracket I assume this is the intended behaviour. Switching to "simple" autoindent mode might help.
Or the author was describing some sort of a bug which has gone?
Is there anyone who can shed some light on that?