Removed a strange logic which breaks alignment if there is an extra line break between blocks to be aligned.

This commit is contained in:
Rustam Vishnyakov
2015-02-19 14:48:21 +03:00
parent 74420dc733
commit 2fb24b5438
5 changed files with 9 additions and 23 deletions
@@ -107,33 +107,19 @@ class AlignmentImpl extends Alignment {
}
LeafBlockWrapper result = null;
if (myOffsetRespBlocks != EMPTY) {
LeafBlockWrapper firstBlockAfterLineFeed = null;
LeafBlockWrapper firstAlignedBlock = null;
LeafBlockWrapper lastAlignedBlock = null;
for (final LeafBlockWrapper current : myOffsetRespBlocks) {
if (block == null || current.getStartOffset() < block.getStartOffset()) {
if (!onDifferentLines(current, block)) {
continue;
}
if (firstAlignedBlock == null || firstAlignedBlock.getStartOffset() > current.getStartOffset()) {
firstAlignedBlock = current;
}
if (lastAlignedBlock == null || lastAlignedBlock.getStartOffset() < current.getStartOffset()) {
lastAlignedBlock = current;
}
if (firstBlockAfterLineFeed == null && current.getWhiteSpace().containsLineFeeds()) {
firstBlockAfterLineFeed = current;
}
}
//each.remove();
}
if (firstBlockAfterLineFeed != null) {
result = firstBlockAfterLineFeed;
}
else if (firstAlignedBlock != null) {
if (firstAlignedBlock != null) {
result = firstAlignedBlock;
}
else {
+1 -1
View File
@@ -12,5 +12,5 @@ xsi:schemaLocation=
http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd
http://jboss.com/products/seam/async http://jboss.com/products/seam/async-2.0.xsd
http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.0.xsd"
<caret>xmlns:async="http://jboss.com/products/seam/async"
<caret>xmlns:async="http://jboss.com/products/seam/async"
/>
+2 -2
View File
@@ -4,8 +4,8 @@ xmlns:persistence="http://jboss.com/products/seam/persistence"
xmlns:framework="http://jboss.com/products/seam/framework"
xmlns:web="http://jboss.com/products/seam/web"
xmlns:security="http://jboss.com/products/seam/security"
<caret>xmlns:async="http://jboss.com/products/seam/async"
xmlns:xsi
<caret>xmlns:async="http://jboss.com/products/seam/async"
xmlns:xsi
="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd
+2 -2
View File
@@ -6,8 +6,8 @@ xmlns:web="http://jboss.com/products/seam/web"
xmlns:security="http://jboss.com/products/seam/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:async="http://jboss.com/products/seam/async"
<caret>xsi:schemaLocation=
"http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd
<caret>xsi:schemaLocation=
"http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd
http://jboss.com/products/seam/framework http://jboss.com/products/seam/framework-2.0.xsd
http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd
http://jboss.com/products/seam/async http://jboss.com/products/seam/async-2.0.xsd
+3 -3
View File
@@ -4,12 +4,12 @@ xmlns:persistence="http://jboss.com/products/seam/persistence"
xmlns:framework="http://jboss.com/products/seam/framework"
xmlns:web="http://jboss.com/products/seam/web"
xmlns:security="http://jboss.com/products/seam/security"
<caret>xsi:schemaLocation=
"http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd
<caret>xsi:schemaLocation=
"http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd
http://jboss.com/products/seam/framework http://jboss.com/products/seam/framework-2.0.xsd
http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd
http://jboss.com/products/seam/async http://jboss.com/products/seam/async-2.0.xsd
http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:async="http://jboss.com/products/seam/async"
/>