From 7968b7ce7e5811e684dc02f3ac42511ca68cae2f Mon Sep 17 00:00:00 2001 From: Python-37 <19404655+Python-37@users.noreply.github.com> Date: Wed, 10 Mar 2021 17:27:58 +0800 Subject: [PATCH 1/3] Fix bug of some IMEs cannot input in terminal Fix bug of QQ pinyin and Rime IME cannot input characters in terminal. --- css/xterm.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css/xterm.css b/css/xterm.css index 7ddcc2d0..bbadb190 100644 --- a/css/xterm.css +++ b/css/xterm.css @@ -59,7 +59,7 @@ } .xterm .xterm-helper-textarea { - padding: 0; +/* padding: 0; */ border: 0; margin: 0; /* Move textarea out of the screen to the far left, so that the cursor is not visible */ From 00bdd2805a27c2bef8d2e4ac7d61c2cdefa2c17b Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Thu, 18 Mar 2021 08:14:27 -0700 Subject: [PATCH 2/3] Ensure in js that the textarea is always > 1x1px --- css/xterm.css | 2 +- src/browser/input/CompositionHelper.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/css/xterm.css b/css/xterm.css index bbadb190..7ddcc2d0 100644 --- a/css/xterm.css +++ b/css/xterm.css @@ -59,7 +59,7 @@ } .xterm .xterm-helper-textarea { -/* padding: 0; */ + padding: 0; border: 0; margin: 0; /* Move textarea out of the screen to the far left, so that the cursor is not visible */ diff --git a/src/browser/input/CompositionHelper.ts b/src/browser/input/CompositionHelper.ts index f93483d3..32f8bbb9 100644 --- a/src/browser/input/CompositionHelper.ts +++ b/src/browser/input/CompositionHelper.ts @@ -222,6 +222,9 @@ export class CompositionHelper { const compositionViewBounds = this._compositionView.getBoundingClientRect(); this._textarea.style.left = cursorLeft + 'px'; this._textarea.style.top = cursorTop + 'px'; + // Ensure the text area is at least 1x1, otherwise certain IMEs may break + this._textarea.style.width = Math.max(compositionViewBounds.width, 1) + 'px'; + this._textarea.style.height = Math.max(compositionViewBounds.height, 1) + 'px'; this._textarea.style.width = compositionViewBounds.width + 'px'; this._textarea.style.height = compositionViewBounds.height + 'px'; this._textarea.style.lineHeight = compositionViewBounds.height + 'px'; From 886f285ab7c54b29b4b0c4e15174e43743d2997d Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Thu, 18 Mar 2021 08:31:13 -0700 Subject: [PATCH 3/3] Remove old setting dimensions --- src/browser/input/CompositionHelper.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/browser/input/CompositionHelper.ts b/src/browser/input/CompositionHelper.ts index 32f8bbb9..85cfc3b6 100644 --- a/src/browser/input/CompositionHelper.ts +++ b/src/browser/input/CompositionHelper.ts @@ -225,8 +225,6 @@ export class CompositionHelper { // Ensure the text area is at least 1x1, otherwise certain IMEs may break this._textarea.style.width = Math.max(compositionViewBounds.width, 1) + 'px'; this._textarea.style.height = Math.max(compositionViewBounds.height, 1) + 'px'; - this._textarea.style.width = compositionViewBounds.width + 'px'; - this._textarea.style.height = compositionViewBounds.height + 'px'; this._textarea.style.lineHeight = compositionViewBounds.height + 'px'; }