diff options
author | Thomas Wolf | 2019-09-15 20:16:33 +0000 |
---|---|---|
committer | Thomas Wolf | 2019-09-20 10:52:51 +0000 |
commit | 7a5e4151a82888aa5c3983f376e9c04b4c401fe6 (patch) | |
tree | d5f2851a571bec7fba2460db57604b0de092fd87 | |
parent | 22721147de5228f9e65664e20dc7a69e694c975b (diff) | |
download | egit-7a5e4151a82888aa5c3983f376e9c04b4c401fe6.tar.gz egit-7a5e4151a82888aa5c3983f376e9c04b4c401fe6.tar.xz egit-7a5e4151a82888aa5c3983f376e9c04b4c401fe6.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>
-rw-r--r-- | org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/OldNewLogicalLineNumberRulerColumn.java | 9 |
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 d72c574085..3c47b01f84 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()); } |