提交 bc854f2e 编写于 作者: J Joao Moreno

fixes #2547

上级 96e05824
......@@ -136,7 +136,7 @@ export class InputBox extends Widget {
}
}
setTimeout(() => this.layout(), 0);
setTimeout(() => this.updateMirror(), 0);
// Support actions
if (this.options.actions) {
......@@ -357,19 +357,25 @@ export class InputBox extends Widget {
this._onDidChange.fire(this.value);
this.validate();
if (this.mirror) {
let lastCharCode = this.value.charCodeAt(this.value.length - 1);
let suffix = lastCharCode === 10 ? ' ' : '';
this.mirror.textContent = this.value + suffix;
this.layout();
}
this.updateMirror();
if (this.state === 'open') {
this.contextViewProvider.layout();
}
}
private updateMirror(): void {
if (!this.mirror) {
return;
}
const value = this.value || this.placeholder;
let lastCharCode = value.charCodeAt(value.length - 1);
let suffix = lastCharCode === 10 ? ' ' : '';
this.mirror.textContent = value + suffix;
this.layout();
}
public layout(): void {
if (!this.mirror) {
return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册