mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-03 07:05:24 +02:00
bug 205393: [terminal] terminal causes stack overflow
https://bugs.eclipse.org/bugs/show_bug.cgi?id=205393
This commit is contained in:
parent
a6bab8287c
commit
a4699ff8ef
1 changed files with 26 additions and 16 deletions
|
@ -35,6 +35,10 @@ abstract public class AbstractTextCanvasModel implements ITextCanvasModel {
|
|||
private ITerminalTextDataSnapshot fSelectionSnapshot;
|
||||
private String fCurrentSelection=""; //$NON-NLS-1$
|
||||
private final Point fSelectionAnchor=new Point(0,0);
|
||||
/**
|
||||
* do not update while update is running
|
||||
*/
|
||||
boolean fInUpdate;
|
||||
|
||||
public AbstractTextCanvasModel(ITerminalTextDataSnapshot snapshot) {
|
||||
fSnapshot=snapshot;
|
||||
|
@ -75,22 +79,28 @@ abstract public class AbstractTextCanvasModel implements ITextCanvasModel {
|
|||
return fSnapshot;
|
||||
}
|
||||
protected void updateSnapshot() {
|
||||
if(fSnapshot.isOutOfDate()) {
|
||||
fSnapshot.updateSnapshot(false);
|
||||
if(fSnapshot.hasTerminalChanged())
|
||||
fireTerminalDataChanged();
|
||||
// TODO why does hasDimensionsChanged not work??????
|
||||
// if(fSnapshot.hasDimensionsChanged())
|
||||
// fireDimensionsChanged();
|
||||
if(fLines!=fSnapshot.getHeight()) {
|
||||
fireDimensionsChanged(fSnapshot.getWidth(),fSnapshot.getHeight());
|
||||
fLines=fSnapshot.getHeight();
|
||||
}
|
||||
int y=fSnapshot.getFirstChangedLine();
|
||||
// has any line changed?
|
||||
if(y<Integer.MAX_VALUE) {
|
||||
int height=fSnapshot.getLastChangedLine()-y+1;
|
||||
fireCellRangeChanged(0, y, fSnapshot.getWidth(), height);
|
||||
if(!fInUpdate && fSnapshot.isOutOfDate()) {
|
||||
fInUpdate=true;
|
||||
try {
|
||||
fSnapshot.updateSnapshot(false);
|
||||
if(fSnapshot.hasTerminalChanged())
|
||||
fireTerminalDataChanged();
|
||||
// TODO why does hasDimensionsChanged not work??????
|
||||
// if(fSnapshot.hasDimensionsChanged())
|
||||
// fireDimensionsChanged();
|
||||
if(fLines!=fSnapshot.getHeight()) {
|
||||
fireDimensionsChanged(fSnapshot.getWidth(),fSnapshot.getHeight());
|
||||
fLines=fSnapshot.getHeight();
|
||||
}
|
||||
int y=fSnapshot.getFirstChangedLine();
|
||||
// has any line changed?
|
||||
if(y<Integer.MAX_VALUE) {
|
||||
int height=fSnapshot.getLastChangedLine()-y+1;
|
||||
fireCellRangeChanged(0, y, fSnapshot.getWidth(), height);
|
||||
}
|
||||
|
||||
} finally {
|
||||
fInUpdate=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue