update files

This commit is contained in:
nuintun 2015-11-26 13:24:34 +08:00
parent 39dfb29524
commit 0f6cc6bd35

View File

@ -38,10 +38,12 @@ function scroll(xterm){
var parent = xterm.element.parentNode; var parent = xterm.element.parentNode;
if (parent) { if (parent) {
var viewHeight = xterm.element.parentNode.clientHeight; var height = (xterm.y + 2) * 18;
var scrollTop = parent.scrollTop;
var viewHeight = parent.clientHeight;
if (viewHeight < xterm.y * 18) { if (scrollTop > height || height > scrollTop + viewHeight) {
xterm.children[xterm.y].scrollIntoView(); parent.scrollTop = Math.max(0, height - viewHeight);
} }
} }
} }
@ -62,7 +64,7 @@ function createXTerm(name, xtermNode){
xterm.focus(); xterm.focus();
xtermNode.appendChild(xterm.element); xtermNode.appendChild(xterm.element);
xterm.children[xterm.y].scrollIntoView(); scroll(xterm);
} }
} }