Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextUtil.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextUtil.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextUtil.java
index 4810cf5f4cb..2421c354d83 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextUtil.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextUtil.java
@@ -305,12 +305,21 @@ public final class JFaceTextUtil {
* be vertically scrolled, <code>false</code> otherwise
*/
public static boolean isShowingEntireContents(StyledText widget) {
- if (widget.getTopPixel() != 0) // more efficient shortcut
+ if (widget.getTopPixel() != 0) {
+ // more efficient shortcut
return false;
+ }
int lastVisiblePixel= computeLastVisiblePixel(widget);
- int lastPossiblePixel= widget.getLinePixel(widget.getLineCount());
- return lastPossiblePixel <= lastVisiblePixel;
+ int bottom= widget.getLineIndex(lastVisiblePixel);
+ if (bottom + 1 < widget.getLineCount()) {
+ // There's definitely more lines below
+ return false;
+ }
+
+ // Check whether the last line is fully visible
+ int bottomLastPixel= getLinePixel(widget, bottom + 1) - 1;
+ return bottomLastPixel <= lastVisiblePixel;
}
/**

Back to the top