Skip to content

Commit 783c4a3

Browse files
authored
Merge pull request #5747 from anthonykim1/anthonykim1/fixIMEoverFlowing
Fix IME composition text overflowing terminal
2 parents 8a1760b + 5528102 commit 783c4a3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/browser/input/CompositionHelper.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,12 @@ export class CompositionHelper {
239239
this._compositionView.style.lineHeight = cellHeight + 'px';
240240
this._compositionView.style.fontFamily = this._optionsService.rawOptions.fontFamily;
241241
this._compositionView.style.fontSize = this._optionsService.rawOptions.fontSize + 'px';
242+
// Limit the composition view width to the space between the cursor and
243+
// the terminal's right edge, preventing it from overflowing the terminal.
244+
const maxWidth = this._bufferService.cols * this._renderService.dimensions.css.cell.width - cursorLeft;
245+
this._compositionView.style.maxWidth = maxWidth + 'px';
246+
this._compositionView.style.overflow = 'hidden';
247+
this._compositionView.style.direction = 'rtl';
242248
// Sync the textarea to the exact position of the composition view so the IME knows where the
243249
// text is.
244250
const compositionViewBounds = this._compositionView.getBoundingClientRect();

0 commit comments

Comments
 (0)