1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 18:56:02 +02:00

bug 205679: [terminal] Before the terminal is connected, the cursor and scrollbar are wrong

https://bugs.eclipse.org/bugs/show_bug.cgi?id=205679
This commit is contained in:
Michael Scharf 2007-10-08 21:12:57 +00:00
parent fcf8a099dd
commit c3f3b3ab7f
3 changed files with 39 additions and 16 deletions

View file

@ -78,14 +78,34 @@ public class VT100EmulatorBackend implements IVT100EmulatorBackend {
if(lines==fLines && cols==fColumns)
return; // nothing to do
// cursor line from the bottom
int cl=fLines-getCursorLine();
int cl=lines-(fLines-getCursorLine());
int cc=getCursorColumn();
int newLines=Math.max(lines,fTerminal.getHeight());
// if the terminal has no history, then resize by
// setting the size to the new size
if(fTerminal.getHeight()==fLines) {
if(lines<fLines) {
cl+=fLines-lines;
newLines=lines;
// shrink by cutting empty lines at the bottom
// int firstNoneEmptyLine;
// for (firstNoneEmptyLine = fTerminal.getHeight(); firstNoneEmptyLine <= 0; firstNoneEmptyLine--) {
// LineSegment[] segments = fTerminal.getLineSegments(firstNoneEmptyLine, 0, fTerminal.getWidth());
// if(segments.length>1)
// break;
// // is the line empty?
// if(segments[0].getText().replaceAll("[\000 ]+", "").length()==0)
// break;
// }
} else {
cl+=fLines-lines;
}
}
fLines=lines;
fColumns=cols;
// make the terminal at least as high as we need lines
fTerminal.setDimensions(Math.max(fLines,fTerminal.getHeight()), fColumns);
setCursor(fLines-cl, cc);
fTerminal.setDimensions(newLines, fColumns);
setCursor(cl, cc);
}
}

View file

@ -163,11 +163,13 @@ public class TextCanvas extends GridCanvas {
}
protected void onResize() {
// if(!isShowHScrollBar()) {
if(fResizeListener!=null) {
Rectangle bonds=getClientArea();
int lines=bonds.height/getCellHeight();
int columns=bonds.width/getCellWidth();
// when the view is minimised, its size is set to 0
// we don't sent this to the terminal!
if(lines>0 && columns>0) {
if(columns<fMinColumns) {
if(!isHorizontalBarVisble()) {
setHorizontalBarVisible(true);
@ -184,12 +186,9 @@ public class TextCanvas extends GridCanvas {
}
if(lines<fMinLines)
lines=fMinLines;
// if(lines>0 && columns>0 && (lines!=getRows()||columns!=getCols())) {
if(lines>0 && columns>0) {
fResizeListener.sizeChanged(lines, columns);
}
}
// }
super.onResize();
calculateGrid();
}

View file

@ -318,14 +318,18 @@ public abstract class VirtualCanvas extends Canvas {
Point size= getSize();
Rectangle clientArea= getClientArea();
ScrollBar horizontal= getHorizontalBar();
if(horizontal.isVisible()) {
// even if setVisible was called on the scrollbar, isVisible
// returns false if its parent is not visible.
if(!isVisible() || horizontal.isVisible()) {
horizontal.setPageIncrement(clientArea.width - horizontal.getIncrement());
int max= fVirtualBounds.width + (size.x - clientArea.width);
horizontal.setMaximum(max);
horizontal.setThumb(size.x > max ? max : size.x);
}
ScrollBar vertical= getVerticalBar();
if(vertical.isVisible()) {
// even if setVisible was called on the scrollbar, isVisible
// returns false if its parent is not visible.
if(!isVisible() || vertical.isVisible()) {
vertical.setPageIncrement(clientArea.height - vertical.getIncrement());
int max= fVirtualBounds.height + (size.y - clientArea.height);
vertical.setMaximum(max);