From 87ed4f07cdad13123f9fb09d40b7e4651f0e4633 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Thu, 1 Apr 2021 08:26:35 -0700 Subject: [PATCH] Tidy up syncTextArea --- src/browser/Terminal.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/browser/Terminal.ts b/src/browser/Terminal.ts index 371f5549..f95013cd 100644 --- a/src/browser/Terminal.ts +++ b/src/browser/Terminal.ts @@ -301,21 +301,22 @@ export class Terminal extends CoreTerminal implements ITerminal { return; } const cursorY = this.buffer.ybase + this.buffer.y; - const viewportRelativeCursorY = cursorY - this.buffer.ydisp; + const bufferLine = this.buffer.lines.get(cursorY); + if (!bufferLine) { + return; + } const cursorX = Math.min(this.buffer.x, this.cols - 1); const cellHeight = this._renderService.dimensions.actualCellHeight; - const bufferLine = this.buffer.lines.get(cursorY); - if (!bufferLine) return; const width = bufferLine.getWidth(cursorX); const cellWidth = this._renderService.dimensions.actualCellWidth * width; - const cursorTop = viewportRelativeCursorY * this._renderService.dimensions.actualCellHeight; + const cursorTop = this.buffer.y * this._renderService.dimensions.actualCellHeight; const cursorLeft = cursorX * this._renderService.dimensions.actualCellWidth; // Sync the textarea to the exact position of the composition view so the IME knows where the // text is. this.textarea.style.left = cursorLeft + 'px'; this.textarea.style.top = cursorTop + 'px'; - this.textarea.style.width = cellWidth +'px'; + this.textarea.style.width = cellWidth + 'px'; this.textarea.style.height = cellHeight + 'px'; this.textarea.style.lineHeight = cellHeight + 'px'; this.textarea.style.zIndex = '-5';