[Bluej-discuss] Moe Editor: Indentation & Block Actions

mpp8 at kent.ac.uk mpp8 at kent.ac.uk
Sun Dec 30 14:54:40 GMT 2007


I've been looking at the source code for the editor, specifically the part for indenting lines.



Firstly,
the doIndent method in MoeActions seems to be created to be used both
to find the indentation required when a new line is created, and to
change/correct the indentation of the current line.



It is called
in three places: NewLineAction, the closingBrace method, and
IndentAction. The latter suggests that it is called when the 'Indent
More' option on the Edit menu is selected, but that is
IndentLineAction. So is IndentAction use at all? If not, then I can't
understand why doIndent checks the location of the caret in the current
line - as it will always be at the beginning (either there's a new
line, or closingBrace has called
"textPane.setCaretPosition(lineStart);" beforehand).





Secondly,
when performing a block action, the code specifically selects the
entirety of all the lines included in the action. The default action
would be to keep the selection as it is before, which would seem to me
to be a more natural way of working - I find it annoying when I change
the indentation, then go to type something in where the caret was
before, only to find that that replaces the whole line, as it has been
entirely selected for no apparent reason. Is there a reason for this?



(This second point is the feature that I was looking in the code to
investigate - I had assumed that it selected all the lines involved
because it would be too difficult to keep track of where the selection
had been before, but I've now found out that it has been specifically
programmed to act like that.) I notice that other IDEs/editors also
work in a similar ways (I last noticed it in either Eclipse or
TextWrangler; I can't remember) - is BlueJ made to fit with a
convention, or is there some other reason?



M Pain
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.bluej.org/pipermail/bluej-discuss/attachments/20071230/55b78e7b/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mpp8.vcf
Type: text/x-vcard
Size: 171 bytes
Desc: Card for <mpp8 at kent.ac.uk>
Url : http://lists.bluej.org/pipermail/bluej-discuss/attachments/20071230/55b78e7b/attachment.vcf 


More information about the bluej-discuss mailing list