Correctly size and position the composition view

This commit is contained in:
Daniel Imms
2016-10-22 16:27:17 -07:00
parent 1ec0bac9c6
commit 553c651166
+9 -3
View File
@@ -178,12 +178,18 @@ CompositionHelper.prototype.updateCompositionElements = function(dontRecurse) {
}
var cursor = this.terminal.element.querySelector('.terminal-cursor');
if (cursor) {
// Take .xterm-rows offsetTop into account as well in case it's positioned absolutely within
// the .xterm element.
var xtermRows = this.terminal.element.querySelector('.xterm-rows');
var cursorTop = xtermRows.offsetTop + cursor.offsetTop;
this.compositionView.style.left = cursor.offsetLeft + 'px';
this.compositionView.style.top = cursor.offsetTop + 'px';
this.compositionView.style.top = cursorTop + 'px';
this.compositionView.style.height = cursor.offsetHeight + 'px';
this.compositionView.style.lineHeight = cursor.offsetHeight + 'px';
var compositionViewBounds = this.compositionView.getBoundingClientRect();
this.textarea.style.left = cursor.offsetLeft + compositionViewBounds.width + 'px';
this.textarea.style.top = cursor.offsetTop + 'px';
this.textarea.style.bottom = (cursor.offsetTop + cursor.offsetHeight) + 'px';
this.textarea.style.top = cursor.cursorTop + 'px';
}
if (!dontRecurse) {
setTimeout(this.updateCompositionElements.bind(this, true), 0);