diff options
author | Christian Pontesegger | 2018-09-12 10:33:29 +0000 |
---|---|---|
committer | Christian Pontesegger | 2018-09-12 10:33:29 +0000 |
commit | 0c67741ab7ee3d2cacc69c09d2936b0cba85ee61 (patch) | |
tree | ffbb85a8d4efc7c5b73d9e8c082d3c2126523a3c | |
parent | 131b8c3f8ac2a0b15da03a087af2a02dfa7c5e52 (diff) | |
download | org.eclipse.ease.core-0c67741ab7ee3d2cacc69c09d2936b0cba85ee61.tar.gz org.eclipse.ease.core-0c67741ab7ee3d2cacc69c09d2936b0cba85ee61.tar.xz org.eclipse.ease.core-0c67741ab7ee3d2cacc69c09d2936b0cba85ee61.zip |
Bug 538973: [ScriptShell] History view does not scroll to the end
fixed with workaround: make sure to add an additional offset to the
original calculation
Change-Id: Ifb7ab3b0f7a33ea51efe0a768205fa78e7f01b20
-rw-r--r-- | plugins/org.eclipse.ease.ui/src/org/eclipse/ease/ui/view/ScriptHistoryText.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/plugins/org.eclipse.ease.ui/src/org/eclipse/ease/ui/view/ScriptHistoryText.java b/plugins/org.eclipse.ease.ui/src/org/eclipse/ease/ui/view/ScriptHistoryText.java index 54d484c0..4da7f0d3 100644 --- a/plugins/org.eclipse.ease.ui/src/org/eclipse/ease/ui/view/ScriptHistoryText.java +++ b/plugins/org.eclipse.ease.ui/src/org/eclipse/ease/ui/view/ScriptHistoryText.java @@ -227,8 +227,7 @@ public class ScriptHistoryText extends StyledText implements IExecutionListener setStyleRange(styleRange); // scroll to end of window - setHorizontalPixel(0); - setTopPixel(getLineHeight() * getLineCount()); + scrollToEnd(); } }); } @@ -272,13 +271,23 @@ public class ScriptHistoryText extends StyledText implements IExecutionListener setStyleRange(styleRange); // scroll to end of window - setHorizontalPixel(0); - setTopPixel(getLineHeight() * getLineCount()); + scrollToEnd(); } }); } /** + * Vertically scroll to the end of the history text. + */ + private void scrollToEnd() { + setHorizontalPixel(0); + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=538973 + // seems the StyledText widget has a strange bug when trying to scroll correctly. we therefore add a factor to the calculated pixel offset to make sure + // we correctly scroll to the end. + setTopPixel((int) (getLineHeight() * getLineCount() * 1.1)); + } + + /** * Get a text representation for the script execution result. * * @param result |