Skip to content

Commit

Permalink
Fix the textarea in the composition view's pos when composing
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyriar committed Oct 24, 2016
1 parent 06a9334 commit 868f151
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/CompositionHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,14 @@ CompositionHelper.prototype.updateCompositionElements = function(dontRecurse) {
this.compositionView.style.top = cursorTop + 'px';
this.compositionView.style.height = cursor.offsetHeight + 'px';
this.compositionView.style.lineHeight = cursor.offsetHeight + 'px';
// Sync the textarea to the exact position of the composition view so the IME knows where the
// text is.
var compositionViewBounds = this.compositionView.getBoundingClientRect();
this.textarea.style.left = cursor.offsetLeft + compositionViewBounds.width + 'px';
this.textarea.style.top = cursor.cursorTop + 'px';
this.textarea.style.left = cursor.offsetLeft + 'px';
this.textarea.style.top = cursorTop + 'px';
this.textarea.style.width = compositionViewBounds.width + 'px';
this.textarea.style.height = compositionViewBounds.height + 'px';
this.textarea.style.lineHeight = compositionViewBounds.height + 'px';
}
if (!dontRecurse) {
setTimeout(this.updateCompositionElements.bind(this, true), 0);
Expand Down
4 changes: 4 additions & 0 deletions src/xterm.css
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
width: 0;
height: 0;
z-index: -10;
/** Prevent wrapping so the IME appears against the textarea at the correct position */
white-space: nowrap;
overflow: hidden;
resize: none;
}

.terminal .terminal-cursor {
Expand Down

0 comments on commit 868f151

Please sign in to comment.