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

Bug 324608 - [terminal] Terminal has strange scrolling behaviour

This commit is contained in:
Martin Oberhuber 2011-05-23 12:19:47 +00:00
parent efe4551f33
commit b05f03a7c8

View file

@ -14,6 +14,7 @@
* Uwe Stieber (Wind River) - [205486] Fix ScrollLock always moving to line 1 * 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) - [219589] Copy an entire line selection
* Anton Leherbauer (Wind River) - [196465] Resizing Terminal changes Scroller location * Anton Leherbauer (Wind River) - [196465] Resizing Terminal changes Scroller location
* Anton Leherbauer (Wind River) - [324608] Terminal has strange scrolling behaviour
*******************************************************************************/ *******************************************************************************/
package org.eclipse.tm.internal.terminal.textcanvas; package org.eclipse.tm.internal.terminal.textcanvas;
@ -97,9 +98,11 @@ public class TextCanvas extends GridCanvas {
if(isDisposed()) if(isDisposed())
return; return;
// scroll to end (unless scroll lock is active) // scroll to end (unless scroll lock is active)
if (!fResizing) if (!fResizing) {
calculateGrid();
scrollToEnd(); scrollToEnd();
} }
}
}); });
// let the cursor blink if the text canvas gets the focus... // let the cursor blink if the text canvas gets the focus...
addFocusListener(new FocusListener(){ addFocusListener(new FocusListener(){
@ -257,14 +260,16 @@ public class TextCanvas extends GridCanvas {
private void calculateGrid() { private void calculateGrid() {
Rectangle virtualBounds = getVirtualBounds(); Rectangle virtualBounds = getVirtualBounds();
setVirtualExtend(getCols()*getCellWidth(),getRows()*getCellHeight());
setRedraw(false); setRedraw(false);
try { try {
setVirtualExtend(getCols()*getCellWidth(),getRows()*getCellHeight());
getParent().layout();
if (fResizing) {
// scroll to end if view port was near last line // scroll to end if view port was near last line
Rectangle viewRect = getViewRectangle(); Rectangle viewRect = getViewRectangle();
if (virtualBounds.height - (viewRect.y + viewRect.height) < getCellHeight() * 2) if (virtualBounds.height - (viewRect.y + viewRect.height) < getCellHeight() * 2)
scrollToEnd(); scrollToEnd();
getParent().layout(); }
} finally { } finally {
setRedraw(true); setRedraw(true);
} }