1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Workaround for platform bug 174419

This commit is contained in:
Anton Leherbauer 2007-02-19 14:36:26 +00:00
parent 8b196aa597
commit 42b59348e6

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006 Wind River Systems, Inc. and others. * Copyright (c) 2007 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -348,9 +348,14 @@ public class LineBackgroundPainter implements IPainter, LineBackgroundListener {
/** /**
* Trigger redraw of given text positions. * Trigger redraw of given text positions.
*
* @param positions
*/ */
private void redrawPositions(List positions) { private void redrawPositions(List positions) {
final int minOffset= fTextViewer.getTopIndexStartOffset(); // TextViewer.getTopIndexStartOffset is buggy
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=174419
// final int minOffset= fTextViewer.getTopIndexStartOffset();
final int minOffset= getTopIndexStartOffset();
final int maxOffset= fTextViewer.getBottomIndexEndOffset()+3; final int maxOffset= fTextViewer.getBottomIndexEndOffset()+3;
Rectangle clientArea= fTextWidget.getClientArea(); Rectangle clientArea= fTextWidget.getClientArea();
int width= clientArea.width + fTextWidget.getHorizontalPixel(); int width= clientArea.width + fTextWidget.getHorizontalPixel();
@ -387,6 +392,20 @@ public class LineBackgroundPainter implements IPainter, LineBackgroundListener {
} }
} }
/**
* Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=174419
* @return the offset of the topmost visible line
* @see ITextViewer#getTopIndexStartOffset()
*/
private int getTopIndexStartOffset() {
if (fTextWidget != null) {
int top= fTextWidget.getTopIndex();
top= fTextWidget.getOffsetAtLine(top);
return getDocumentOffset(top);
}
return -1;
}
/* /*
* @see org.eclipse.jface.text.IPainter#deactivate(boolean) * @see org.eclipse.jface.text.IPainter#deactivate(boolean)
*/ */