Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Pazderski2019-03-14 21:06:46 +0000
committerPaul Pazderski2019-09-15 14:12:16 +0000
commitf15d5f441d9ae8cc24de9ec34fd39b04520917b5 (patch)
treeaa3bd91a0d72b320b6e42fe27a4618048dc42560 /org.eclipse.ui.console/src
parent881615b60a5da2db70cb86a969e26d791c64d473 (diff)
downloadeclipse.platform.debug-f15d5f441d9ae8cc24de9ec34fd39b04520917b5.tar.gz
eclipse.platform.debug-f15d5f441d9ae8cc24de9ec34fd39b04520917b5.tar.xz
eclipse.platform.debug-f15d5f441d9ae8cc24de9ec34fd39b04520917b5.zip
Bug 550618 - [console] IOConsolePartitioner produces overlapping styleI20190915-1800
ranges Old implementation adjusted range start but did not touch the ranges length resulting in invalid overlapping ranges. Change-Id: Ie6cf1289a62a4d63f46b682b67bc72cd2d223bd2 Signed-off-by: Paul Pazderski <paul-eclipse@ppazderski.de>
Diffstat (limited to 'org.eclipse.ui.console/src')
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java19
1 files changed, 16 insertions, 3 deletions
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java
index 81aac3846..67e7b8e1c 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java
@@ -13,6 +13,7 @@
* Paul Pazderski - Contributions for:
* Bug 547064: use binary search for getPartition
* Bug 548356: fixed user input handling
+ * Bug 550618: getStyleRanges produced invalid overlapping styles
*******************************************************************************/
package org.eclipse.ui.internal.console;
@@ -772,11 +773,23 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum
if (!connected) {
return new StyleRange[0];
}
- IOConsolePartition[] computedPartitions = computeIOPartitioning(offset, length);
- StyleRange[] styles = new StyleRange[computedPartitions.length];
+ final IOConsolePartition[] computedPartitions = computeIOPartitioning(offset, length);
+ final StyleRange[] styles = new StyleRange[computedPartitions.length];
for (int i = 0; i < computedPartitions.length; i++) {
- int rangeStart = Math.max(computedPartitions[i].getOffset(), offset);
+ int rangeStart = computedPartitions[i].getOffset();
int rangeLength = computedPartitions[i].getLength();
+
+ // snap partitions to requested range
+ final int underflow = offset - rangeStart;
+ if (underflow > 0) {
+ rangeStart += underflow;
+ rangeLength -= underflow;
+ }
+ final int overflow = (rangeStart + rangeLength) - (offset + length);
+ if (overflow > 0) {
+ rangeLength -= overflow;
+ }
+
styles[i] = computedPartitions[i].getStyleRange(rangeStart, rangeLength);
}
return styles;

Back to the top