mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 17:19:48 +01:00
Fixes Microsoft/monaco-editor#127: Set the font on the canvas context correctly, add an extra 2px for Japanese
This commit is contained in:
@@ -109,12 +109,14 @@ export class KeyboardHandler extends ViewEventHandler implements IDisposable {
|
||||
let cs = dom.getComputedStyle(this.textArea.actual);
|
||||
if (browser.isFirefox) {
|
||||
// computedStyle.font is empty in Firefox...
|
||||
context.font = `${cs.fontStyle} ${cs.fontVariant} ${cs.fontWeight} ${cs.fontStretch} ${cs.fontSize} / ${cs.lineHeight} '${cs.fontFamily}'`;
|
||||
context.font = `${cs.fontStyle} ${cs.fontVariant} ${cs.fontWeight} ${cs.fontStretch} ${cs.fontSize} / ${cs.lineHeight} ${cs.fontFamily}`;
|
||||
let metrics = context.measureText(e.data);
|
||||
StyleMutator.setWidth(this.textArea.actual, metrics.width + 2); // +2 for Japanese...
|
||||
} else {
|
||||
context.font = cs.font;
|
||||
let metrics = context.measureText(e.data);
|
||||
StyleMutator.setWidth(this.textArea.actual, metrics.width);
|
||||
}
|
||||
let metrics = context.measureText(e.data);
|
||||
StyleMutator.setWidth(this.textArea.actual, metrics.width);
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
@@ -117,11 +117,8 @@ export class TextAreaHandler extends Disposable {
|
||||
this.textareaIsShownAtCursor = true;
|
||||
|
||||
// In IE we cannot set .value when handling 'compositionstart' because the entire composition will get canceled.
|
||||
let shouldEmptyTextArea = true;
|
||||
if (shouldEmptyTextArea) {
|
||||
if (!this.Browser.isEdgeOrIE) {
|
||||
this.setTextAreaState('compositionstart', this.textAreaState.toEmpty());
|
||||
}
|
||||
if (!this.Browser.isEdgeOrIE) {
|
||||
this.setTextAreaState('compositionstart', this.textAreaState.toEmpty());
|
||||
}
|
||||
|
||||
this._onCompositionStart.fire({
|
||||
|
||||
Reference in New Issue
Block a user