1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-02 22:55:26 +02:00

Bug 294468 - [terminal] When a horizontal scrollbar is visible, terminal size is missing 1 line

This commit is contained in:
Martin Oberhuber 2010-05-22 00:07:35 +00:00
parent 488a377215
commit ec57b279a1
3 changed files with 13 additions and 8 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007 Wind River Systems, Inc. and others.
* Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,9 +7,11 @@
*
* Contributors:
* Michael Scharf (Wind River) - initial API and implementation
* Anton Leherbauer (Wind River) - [294468] Fix scroller and text line rendering
*******************************************************************************/
package org.eclipse.tm.internal.terminal.textcanvas;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
/**
@ -21,4 +23,5 @@ public interface ILinelRenderer {
void drawLine(ITextCanvasModel model, GC gc, int line, int x, int y, int colFirst, int colLast);
void onFontChange();
void setInvertedColors(boolean invert);
Color getDefaultBackgroundColor();
}

View file

@ -24,6 +24,7 @@ import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
@ -278,7 +279,6 @@ public class TextCanvas extends GridCanvas {
}
/**
* If set then if the size changes
* @param scrollLock
*/
public void setScrollLock(boolean scrollLock) {
fScrollLock=scrollLock;
@ -290,7 +290,9 @@ public class TextCanvas extends GridCanvas {
}
protected void drawLine(GC gc, int line, int x, int y, int colFirst, int colLast) {
fCellRenderer.drawLine(fCellCanvasModel, gc,line,x,y,colFirst, colLast);
}
protected Color getTerminalBackgroundColor() {
return fCellRenderer.getDefaultBackgroundColor();
}
protected void visibleCellRectangleChanged(int x, int y, int width, int height) {
fCellCanvasModel.setVisibleRectangle(y,x,height,width);

View file

@ -29,10 +29,8 @@ import org.eclipse.tm.terminal.model.Style;
public class TextLineRenderer implements ILinelRenderer {
private final ITextCanvasModel fModel;
StyleMap fStyleMap=new StyleMap();
Color fBackgroundColor;
public TextLineRenderer(TextCanvas c, ITextCanvasModel model) {
fModel=model;
fBackgroundColor=Display.getCurrent().getSystemColor(SWT.COLOR_LIST_BACKGROUND);
}
/* (non-Javadoc)
* @see com.imagicus.thumbs.view.ICellRenderer#getCellWidth()
@ -88,15 +86,17 @@ public class TextLineRenderer implements ILinelRenderer {
private void fillBackground(GC gc, int x, int y, int width, int height) {
Color bg=gc.getBackground();
gc.setBackground(getBackgroundColor());
gc.setBackground(getDefaultBackgroundColor());
gc.fillRectangle (x,y,width,height);
gc.setBackground(bg);
}
private Color getBackgroundColor() {
return fBackgroundColor;
public Color getDefaultBackgroundColor() {
// null == default style
return fStyleMap.getBackgroundColor(null);
}
private void drawCursor(ITextCanvasModel model, GC gc, int row, int x, int y, int colFirst) {
if(!model.isCursorOn())
return;