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:
parent
8b196aa597
commit
42b59348e6
1 changed files with 21 additions and 2 deletions
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -348,9 +348,14 @@ public class LineBackgroundPainter implements IPainter, LineBackgroundListener {
|
|||
|
||||
/**
|
||||
* Trigger redraw of given text positions.
|
||||
*
|
||||
* @param 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;
|
||||
Rectangle clientArea= fTextWidget.getClientArea();
|
||||
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)
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue