Fixed problem when some visual artifacts may appear after resize (#2578)

This commit is contained in:
Leonid 2018-10-02 02:12:40 +03:00 committed by Ryan C
parent 1987c9fb06
commit 5c9a9cd05e
2 changed files with 9 additions and 8 deletions

View File

@ -64,7 +64,8 @@ export class NeovimRenderer extends React.PureComponent<INeovimRendererProps, {}
const width = this._element.offsetWidth
const height = this._element.offsetHeight
this.props.neovimInstance.resize(width, height)
this.props.renderer.redrawAll(this.props.screen)
this.props.neovimInstance
.resize(width, height)
.then(() => this.props.renderer.redrawAll(this.props.screen))
}
}

View File

@ -683,13 +683,13 @@ export class NeovimInstance extends EventEmitter implements INeovimInstance {
})
}
public resize(widthInPixels: number, heightInPixels: number): void {
public resize(widthInPixels: number, heightInPixels: number): Promise<{}> {
this._lastWidthInPixels = widthInPixels
this._lastHeightInPixels = heightInPixels
const size = this._getSize()
this._resizeInternal(size.rows, size.cols)
return this._resizeInternal(size.rows, size.cols)
}
public async getApiVersion(): Promise<INeovimApiVersion> {
@ -742,7 +742,7 @@ export class NeovimInstance extends EventEmitter implements INeovimInstance {
})
}
private _resizeInternal(rows: number, columns: number): void {
private _resizeInternal(rows: number, columns: number): Promise<{}> {
if (this._configuration.hasValue("debug.fixedSize")) {
const fixedSize = this._configuration.getValue("debug.fixedSize")
rows = fixedSize.rows
@ -751,7 +751,7 @@ export class NeovimInstance extends EventEmitter implements INeovimInstance {
}
if (rows === this._rows && columns === this._cols) {
return
return Promise.resolve({})
}
this._rows = rows
@ -760,10 +760,10 @@ export class NeovimInstance extends EventEmitter implements INeovimInstance {
// If _initPromise isn't initialized, it means the UI hasn't attached to NeoVim
// yet. In that case, we don't need to call uiTryResize
if (!this._initPromise) {
return
return Promise.resolve({})
}
this._initPromise.then(() => {
return this._initPromise.then(() => {
return this._neovim.request("nvim_ui_try_resize", [columns, rows])
})
}