Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2019-09-15 16:16:33 -0400
committerThomas Wolf2019-09-15 16:17:43 -0400
commit40aabadfa778573757b3d020f9b4d7945658dd6d (patch)
tree40325aac86972a6859ae14526b93db159cff7354 /org.eclipse.egit.ui
parent7406c4437f632da3e827e6bca44c26419ff72de2 (diff)
downloadegit-40aabadfa778573757b3d020f9b4d7945658dd6d.tar.gz
egit-40aabadfa778573757b3d020f9b4d7945658dd6d.tar.xz
egit-40aabadfa778573757b3d020f9b4d7945658dd6d.zip
Re-layout line number ruler in unified diff viewer
The old-new line number ruler in the diff viewer in the commit editor did not always properly adapt its size when the size of the text editor changed. Visible for instance after maximizing a diff viewer such that there is no horizontal scroll bar anymore, then resetting to its original size. Line numbers would suddenly appear at the very bottom, next to the (now visible again) horizontal scroll bar. Force a re-layout when the size of the editor changes. This fix is crucial for https://git.eclipse.org/r/#/c/149547/ , which otherwise may run into exceptions trying to draw images with a negative height. Change-Id: I8a750f57ab9804c932a92b40c0c92988229c5032 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.egit.ui')
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/OldNewLogicalLineNumberRulerColumn.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/OldNewLogicalLineNumberRulerColumn.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/OldNewLogicalLineNumberRulerColumn.java
index d72c57408..3c47b01f8 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/OldNewLogicalLineNumberRulerColumn.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/OldNewLogicalLineNumberRulerColumn.java
@@ -18,6 +18,8 @@ import org.eclipse.jface.text.source.IAnnotationModel;
import org.eclipse.jface.text.source.LineNumberRulerColumn;
import org.eclipse.jgit.diff.DiffEntry;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.GC;
@@ -210,6 +212,13 @@ public class OldNewLogicalLineNumberRulerColumn extends LineNumberRulerColumn {
}
}
};
+ parentControl.addControlListener(new ControlAdapter() {
+
+ @Override
+ public void controlResized(ControlEvent e) {
+ parentRuler.relayout();
+ }
+ });
return composite.createControl(parentControl,
parentRuler.getTextViewer());
}

Back to the top