1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-13 12:05:21 +02:00

[fix] Bug 281238: The very first few characters might be missing in the terminal control if opened and connected programmatically

This commit is contained in:
Uwe Stieber 2009-06-25 06:57:13 +00:00
parent f05f0ebf99
commit b35aac5df5

View file

@ -8,6 +8,7 @@
* Contributors: * Contributors:
* Michael Scharf (Wind River) - initial API and implementation * Michael Scharf (Wind River) - initial API and implementation
* Michael Scharf (Wind River) - [240098] The cursor should not blink when the terminal is disconnected * Michael Scharf (Wind River) - [240098] The cursor should not blink when the terminal is disconnected
* Uwe Stieber (Wind River) - [281238] The very first few characters might be missing in the terminal control if opened and connected programmatically
*******************************************************************************/ *******************************************************************************/
package org.eclipse.tm.internal.terminal.textcanvas; package org.eclipse.tm.internal.terminal.textcanvas;
@ -177,14 +178,14 @@ public class TextCanvas extends GridCanvas {
fMinLines = minLines; fMinLines = minLines;
} }
protected void onResize() { protected void onResize(boolean init) {
if(fResizeListener!=null) { if(fResizeListener!=null) {
Rectangle bonds=getClientArea(); Rectangle bonds=getClientArea();
int lines=bonds.height/getCellHeight(); int lines=bonds.height/getCellHeight();
int columns=bonds.width/getCellWidth(); int columns=bonds.width/getCellWidth();
// when the view is minimised, its size is set to 0 // when the view is minimised, its size is set to 0
// we don't sent this to the terminal! // we don't sent this to the terminal!
if(lines>0 && columns>0) { if(lines>0 && columns>0 || init) {
if(columns<fMinColumns) { if(columns<fMinColumns) {
if(!isHorizontalBarVisble()) { if(!isHorizontalBarVisble()) {
setHorizontalBarVisible(true); setHorizontalBarVisible(true);
@ -208,6 +209,10 @@ public class TextCanvas extends GridCanvas {
calculateGrid(); calculateGrid();
} }
protected void onResize() {
onResize(false);
}
private void calculateGrid() { private void calculateGrid() {
setVirtualExtend(getCols()*getCellWidth(),getRows()*getCellHeight()); setVirtualExtend(getCols()*getCellWidth(),getRows()*getCellHeight());
// scroll to end // scroll to end
@ -294,6 +299,14 @@ public class TextCanvas extends GridCanvas {
if(fResizeListener!=null) if(fResizeListener!=null)
throw new IllegalArgumentException("There can be at most one listener at the moment!"); //$NON-NLS-1$ throw new IllegalArgumentException("There can be at most one listener at the moment!"); //$NON-NLS-1$
fResizeListener=listener; fResizeListener=listener;
// Bug 281238: [terminal] The very first few characters might be missing in
// the terminal control if opened and connected programmatically
//
// In case the terminal had not been visible yet or is to small (less than one
// line visible), the terminal should have a minimum size to avoid RuntimeExceptions.
setMinColumns(80); setMinLines(24);
onResize(true);
} }
public void onFontChange() { public void onFontChange() {
@ -323,7 +336,7 @@ public class TextCanvas extends GridCanvas {
fCursorEnabled=enabled; fCursorEnabled=enabled;
fCellCanvasModel.setCursorEnabled(fCursorEnabled); fCellCanvasModel.setCursorEnabled(fCursorEnabled);
} }
} }
} }