Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael Istria2018-03-23 07:14:00 -0400
committerMickael Istria2018-03-23 07:14:00 -0400
commitbcefc04ef2677b4099003e22a90c007c862a0390 (patch)
tree1a5d5948aca4001373c5333a2dabd48ac87d353f /org.eclipse.jface.text/src
parent653dc97a4b1de7850ec142af39c92483e29adb62 (diff)
downloadeclipse.platform.text-bcefc04ef2677b4099003e22a90c007c862a0390.tar.gz
eclipse.platform.text-bcefc04ef2677b4099003e22a90c007c862a0390.tar.xz
eclipse.platform.text-bcefc04ef2677b4099003e22a90c007c862a0390.zip
Bug 531952 - [CodeMining] erroneous folding icons location
Monitor the text change for modified line count to update the folding icons position. Change-Id: I0b4460be3c3b8ce8c30870cac92235d27c84a3ee Signed-off-by: Mickael Istria <mistria@redhat.com>
Diffstat (limited to 'org.eclipse.jface.text/src')
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationRulerColumn.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationRulerColumn.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationRulerColumn.java
index 8f8b58c24..132f249eb 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationRulerColumn.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationRulerColumn.java
@@ -48,10 +48,12 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextListener;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.ITextViewerExtension5;
import org.eclipse.jface.text.JFaceTextUtil;
import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.TextEvent;
/**
@@ -179,6 +181,18 @@ public class AnnotationRulerColumn implements IVerticalRulerColumn, IVerticalRul
private Consumer<StyledText> lineHeightChangeHandler= (t) -> postRedraw();
+ private ITextListener fLineListener = new ITextListener() {
+ private int previousLineCount = -1;
+
+ @Override
+ public void textChanged(TextEvent event) {
+ if (event.getViewerRedrawState() && fCachedTextWidget.getLineCount() != previousLineCount) {
+ previousLineCount= fCachedTextWidget.getLineCount();
+ postRedraw();
+ }
+ }
+ };
+
/**
* Constructs this column with the given arguments.
*
@@ -325,6 +339,7 @@ public class AnnotationRulerColumn implements IVerticalRulerColumn, IVerticalRul
if (fCachedTextViewer != null) {
VisibleLinesTracker.track(fCachedTextViewer, lineHeightChangeHandler);
+ fCachedTextViewer.addTextListener(fLineListener);
// on word wrap toggle a "resized" ControlEvent is fired: suggest a redraw of the ruler
fCachedTextWidget.addControlListener(new ControlAdapter() {
@Override
@@ -493,6 +508,7 @@ public class AnnotationRulerColumn implements IVerticalRulerColumn, IVerticalRul
if (fCachedTextViewer != null) {
VisibleLinesTracker.untrack(fCachedTextViewer, lineHeightChangeHandler);
+ fCachedTextViewer.removeTextListener(fLineListener);
}
if (fModel != null)

Back to the top