mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-14 12:35:22 +02:00
bug 205772: [terminal] crash on linux (division by zero)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=205772
This commit is contained in:
parent
354ec9ead0
commit
0f9ca60727
4 changed files with 9 additions and 14 deletions
|
@ -82,8 +82,7 @@ public class TerminalTextUITest {
|
||||||
// TODO how to get the initial size correctly!
|
// TODO how to get the initial size correctly!
|
||||||
snapshot.updateSnapshot(false);
|
snapshot.updateSnapshot(false);
|
||||||
fgModel=new PollingTextCanvasModel(snapshot);
|
fgModel=new PollingTextCanvasModel(snapshot);
|
||||||
fgTextCanvas=new TextCanvas(shell,fgModel, SWT.NONE);
|
fgTextCanvas=new TextCanvas(shell,fgModel, SWT.NONE,new TextLineRenderer(fgTextCanvas,fgModel));
|
||||||
fgTextCanvas.setCellRenderer(new TextLineRenderer(fgTextCanvas,fgModel));
|
|
||||||
fgTextCanvas.setLayoutData(new GridData(GridData.FILL_BOTH));
|
fgTextCanvas.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -486,8 +486,8 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
|
||||||
// TODO how to get the initial size correctly!
|
// TODO how to get the initial size correctly!
|
||||||
snapshot.updateSnapshot(false);
|
snapshot.updateSnapshot(false);
|
||||||
ITextCanvasModel canvasModel=new PollingTextCanvasModel(snapshot);
|
ITextCanvasModel canvasModel=new PollingTextCanvasModel(snapshot);
|
||||||
fCtlText=new TextCanvas(fWndParent,canvasModel,SWT.NONE);
|
fCtlText=new TextCanvas(fWndParent,canvasModel,SWT.NONE,new TextLineRenderer(fCtlText,canvasModel));
|
||||||
fCtlText.setCellRenderer(new TextLineRenderer(fCtlText,canvasModel));
|
|
||||||
|
|
||||||
fCtlText.setLayoutData(new GridData(GridData.FILL_BOTH));
|
fCtlText.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
fCtlText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
|
fCtlText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.eclipse.swt.widgets.Composite;
|
||||||
public class TextCanvas extends GridCanvas {
|
public class TextCanvas extends GridCanvas {
|
||||||
protected final ITextCanvasModel fCellCanvasModel;
|
protected final ITextCanvasModel fCellCanvasModel;
|
||||||
/** Renders the cells */
|
/** Renders the cells */
|
||||||
private ILinelRenderer fCellRenderer;
|
private final ILinelRenderer fCellRenderer;
|
||||||
private boolean fScrollLock;
|
private boolean fScrollLock;
|
||||||
private Point fDraggingStart;
|
private Point fDraggingStart;
|
||||||
private Point fDraggingEnd;
|
private Point fDraggingEnd;
|
||||||
|
@ -44,8 +44,11 @@ public class TextCanvas extends GridCanvas {
|
||||||
* Create a new CellCanvas with the given SWT style bits.
|
* Create a new CellCanvas with the given SWT style bits.
|
||||||
* (SWT.H_SCROLL and SWT.V_SCROLL are automatically added).
|
* (SWT.H_SCROLL and SWT.V_SCROLL are automatically added).
|
||||||
*/
|
*/
|
||||||
public TextCanvas(Composite parent, ITextCanvasModel model, int style) {
|
public TextCanvas(Composite parent, ITextCanvasModel model, int style,ILinelRenderer cellRenderer) {
|
||||||
super(parent, style | SWT.H_SCROLL | SWT.V_SCROLL);
|
super(parent, style | SWT.H_SCROLL | SWT.V_SCROLL);
|
||||||
|
fCellRenderer=cellRenderer;
|
||||||
|
setCellWidth(fCellRenderer.getCellWidth());
|
||||||
|
setCellHeight(fCellRenderer.getCellHeight());
|
||||||
fCellCanvasModel=model;
|
fCellCanvasModel=model;
|
||||||
fCellCanvasModel.addCellCanvasModelListener(new ITextCanvasModelListener(){
|
fCellCanvasModel.addCellCanvasModelListener(new ITextCanvasModelListener(){
|
||||||
public void cellSizeChanged() {
|
public void cellSizeChanged() {
|
||||||
|
@ -137,11 +140,6 @@ public class TextCanvas extends GridCanvas {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void setCellRenderer(ILinelRenderer cellRenderer) {
|
|
||||||
fCellRenderer = cellRenderer;
|
|
||||||
setCellWidth(fCellRenderer.getCellWidth());
|
|
||||||
setCellHeight(fCellRenderer.getCellHeight());
|
|
||||||
}
|
|
||||||
public ILinelRenderer getCellRenderer() {
|
public ILinelRenderer getCellRenderer() {
|
||||||
return fCellRenderer;
|
return fCellRenderer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,14 +24,12 @@ import org.eclipse.tm.terminal.model.Style;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TextLineRenderer implements ILinelRenderer {
|
public class TextLineRenderer implements ILinelRenderer {
|
||||||
TextCanvas fCanvas;
|
|
||||||
private final ITextCanvasModel fModel;
|
private final ITextCanvasModel fModel;
|
||||||
StyleMap fStyleMap=new StyleMap();
|
StyleMap fStyleMap=new StyleMap();
|
||||||
Color fBackgroundColor;
|
Color fBackgroundColor;
|
||||||
public TextLineRenderer(TextCanvas c, ITextCanvasModel model) {
|
public TextLineRenderer(TextCanvas c, ITextCanvasModel model) {
|
||||||
fCanvas=c;
|
|
||||||
fModel=model;
|
fModel=model;
|
||||||
fBackgroundColor=c.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND);
|
fBackgroundColor=Display.getCurrent().getSystemColor(SWT.COLOR_LIST_BACKGROUND);
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see com.imagicus.thumbs.view.ICellRenderer#getCellWidth()
|
* @see com.imagicus.thumbs.view.ICellRenderer#getCellWidth()
|
||||||
|
|
Loading…
Add table
Reference in a new issue