tweezy23 / anyedittools

Automatically exported from code.google.com/p/anyedittools
2 stars 0 forks source link

Sort functionality #54

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Here is a patch which adds some sort functionality to AnyEdit.

The patch was created against the latest revision 69aa3375f190.

Tested with Eclipse 3.5.2, Eclipse 3.6.1 and Java 1.6.0 under Debian GNU/Linux 
5.0.

Original issue reported on code.google.com by clemens....@googlemail.com on 27 Jan 2011 at 4:42

Attachments:

GoogleCodeExporter commented 9 years ago
I forgot to say: The patch is released under the Eclipse Public License v1.0.

Original comment by clemens....@googlemail.com on 27 Jan 2011 at 4:46

Attachments:

GoogleCodeExporter commented 9 years ago
Hi Clemens,

thank you for the nice patch!

I've slightly modified the code, can you please verify if this is ok?

Regards,
Andrei

Original comment by iloveeclipse on 27 Jan 2011 at 9:10

GoogleCodeExporter commented 9 years ago
Hello Andrei,

The sort icon looks good!

Two points:

1. Decreasing the rangeToReplace by the length of the delimiter on line 73 in 
the AbstractSortAction in revision 0fdd8efe12 does introduce a strange 
behaviour. Please see 54-2.txt, 54-2-before-sort.png and 54-2-after-sort.png. 
The selected text was sorted by "Numerically 9-0".

2. The change in revision 0fdd8efe12 also removed the delimiter handling of the 
last line in the getLines method in the AbstractSortAction. If the document 
doesn't end with a line delimiter and the last line is part of the sort, then 
the sorted lines are "messed up". In some cases this can also result in an 
unexpected BadLocationException. See 54-1.txt, 54-1-before-sort.png, 
54-1-after-sort.png and 54-1-BadLocationException.txt. The selected text was 
sorted by "Case-Sensitive Z-A".

For example, GNU sort does the same thing with the last line: 
http://www.gnu.org/software/coreutils/manual/html_node/sort-invocation.html: 
"In addition, if the final byte of an input file is not a newline, GNU sort 
silently supplies one".

Original comment by clemens....@googlemail.com on 28 Jan 2011 at 2:22

Attachments:

GoogleCodeExporter commented 9 years ago
Hi Clemens,
thanks for reviewing!

Issues your saw should be fixed now, please verify. The point is, that we 
should not think about line delimiters at all, as all what we need is to 
exchange content only line to line.

CU
Andrei

Original comment by iloveeclipse on 28 Jan 2011 at 9:04

GoogleCodeExporter commented 9 years ago
Hello Andrei,

The latest revision works now flawlessly here!

Good to know that the line delimiter handling wasn't needed at all. It was the 
most confusing part of my patch.

Original comment by clemens....@googlemail.com on 29 Jan 2011 at 1:25

GoogleCodeExporter commented 9 years ago
Hi Clemens,
again many thanks for the nice contribution.
I've just released new 2.4.0 release containing additionally compatibility 
patch for Eclipse 3.7 M5.
Closing as fixed.
Regards,
Andrei

Original comment by iloveeclipse on 29 Jan 2011 at 9:22