mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-19 15:05:36 +02:00
Bug 196465 - [terminal] Resizing Terminal changes Scroller location
This commit is contained in:
parent
45c9e38b20
commit
909781e733
1 changed files with 17 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2007, 2011 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
|
||||
|
@ -13,6 +13,7 @@
|
|||
* Anton Leherbauer (Wind River) - [294468] Fix scroller and text line rendering
|
||||
* Uwe Stieber (Wind River) - [205486] Fix ScrollLock always moving to line 1
|
||||
* Anton Leherbauer (Wind River) - [219589] Copy an entire line selection
|
||||
* Anton Leherbauer (Wind River) - [196465] Resizing Terminal changes Scroller location
|
||||
*******************************************************************************/
|
||||
package org.eclipse.tm.internal.terminal.textcanvas;
|
||||
|
||||
|
@ -73,6 +74,8 @@ public class TextCanvas extends GridCanvas {
|
|||
private int fMinColumns=80;
|
||||
private int fMinLines=4;
|
||||
private boolean fCursorEnabled;
|
||||
private boolean fResizing;
|
||||
|
||||
/**
|
||||
* Create a new CellCanvas with the given SWT style bits.
|
||||
* (SWT.H_SCROLL and SWT.V_SCROLL are automatically added).
|
||||
|
@ -94,6 +97,7 @@ public class TextCanvas extends GridCanvas {
|
|||
if(isDisposed())
|
||||
return;
|
||||
// scroll to end (unless scroll lock is active)
|
||||
if (!fResizing)
|
||||
scrollToEnd();
|
||||
}
|
||||
});
|
||||
|
@ -243,14 +247,22 @@ public class TextCanvas extends GridCanvas {
|
|||
}
|
||||
|
||||
protected void onResize() {
|
||||
fResizing = true;
|
||||
try {
|
||||
onResize(false);
|
||||
} finally {
|
||||
fResizing = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void calculateGrid() {
|
||||
Rectangle virtualBounds = getVirtualBounds();
|
||||
setVirtualExtend(getCols()*getCellWidth(),getRows()*getCellHeight());
|
||||
setRedraw(false);
|
||||
try {
|
||||
// scroll to end (unless scroll lock is active)
|
||||
// scroll to end if view port was near last line
|
||||
Rectangle viewRect = getViewRectangle();
|
||||
if (virtualBounds.height - (viewRect.y + viewRect.height) < getCellHeight() * 2)
|
||||
scrollToEnd();
|
||||
getParent().layout();
|
||||
} finally {
|
||||
|
|
Loading…
Add table
Reference in a new issue