mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-03 07:05:24 +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!
|
||||
snapshot.updateSnapshot(false);
|
||||
fgModel=new PollingTextCanvasModel(snapshot);
|
||||
fgTextCanvas=new TextCanvas(shell,fgModel, SWT.NONE);
|
||||
fgTextCanvas.setCellRenderer(new TextLineRenderer(fgTextCanvas,fgModel));
|
||||
fgTextCanvas=new TextCanvas(shell,fgModel, SWT.NONE,new TextLineRenderer(fgTextCanvas,fgModel));
|
||||
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!
|
||||
snapshot.updateSnapshot(false);
|
||||
ITextCanvasModel canvasModel=new PollingTextCanvasModel(snapshot);
|
||||
fCtlText=new TextCanvas(fWndParent,canvasModel,SWT.NONE);
|
||||
fCtlText.setCellRenderer(new TextLineRenderer(fCtlText,canvasModel));
|
||||
fCtlText=new TextCanvas(fWndParent,canvasModel,SWT.NONE,new TextLineRenderer(fCtlText,canvasModel));
|
||||
|
||||
|
||||
fCtlText.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
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 {
|
||||
protected final ITextCanvasModel fCellCanvasModel;
|
||||
/** Renders the cells */
|
||||
private ILinelRenderer fCellRenderer;
|
||||
private final ILinelRenderer fCellRenderer;
|
||||
private boolean fScrollLock;
|
||||
private Point fDraggingStart;
|
||||
private Point fDraggingEnd;
|
||||
|
@ -44,8 +44,11 @@ public class TextCanvas extends GridCanvas {
|
|||
* Create a new CellCanvas with the given SWT style bits.
|
||||
* (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);
|
||||
fCellRenderer=cellRenderer;
|
||||
setCellWidth(fCellRenderer.getCellWidth());
|
||||
setCellHeight(fCellRenderer.getCellHeight());
|
||||
fCellCanvasModel=model;
|
||||
fCellCanvasModel.addCellCanvasModelListener(new ITextCanvasModelListener(){
|
||||
public void cellSizeChanged() {
|
||||
|
@ -137,11 +140,6 @@ public class TextCanvas extends GridCanvas {
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
public void setCellRenderer(ILinelRenderer cellRenderer) {
|
||||
fCellRenderer = cellRenderer;
|
||||
setCellWidth(fCellRenderer.getCellWidth());
|
||||
setCellHeight(fCellRenderer.getCellHeight());
|
||||
}
|
||||
public ILinelRenderer getCellRenderer() {
|
||||
return fCellRenderer;
|
||||
}
|
||||
|
|
|
@ -24,14 +24,12 @@ import org.eclipse.tm.terminal.model.Style;
|
|||
*
|
||||
*/
|
||||
public class TextLineRenderer implements ILinelRenderer {
|
||||
TextCanvas fCanvas;
|
||||
private final ITextCanvasModel fModel;
|
||||
StyleMap fStyleMap=new StyleMap();
|
||||
Color fBackgroundColor;
|
||||
public TextLineRenderer(TextCanvas c, ITextCanvasModel model) {
|
||||
fCanvas=c;
|
||||
fModel=model;
|
||||
fBackgroundColor=c.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND);
|
||||
fBackgroundColor=Display.getCurrent().getSystemColor(SWT.COLOR_LIST_BACKGROUND);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see com.imagicus.thumbs.view.ICellRenderer#getCellWidth()
|
||||
|
|
Loading…
Add table
Reference in a new issue