提交 9008534b 编写于 作者: M Matt Bierner 提交者: GitHub

Fix onDidChangeTextEditorSelection firing when the editor is resized (#32197)

* Fix onDiChangeTextEditorSelection firing when the editor is resized

**Bug**
onDidChangeTextEditorSelection is being fired when the editor window is resized

**Fix**
Make sure we do not refire this event if the selection in terms of the model has not changed

Fixes #32092

* Fix null deref
上级 78cc8788
......@@ -389,7 +389,12 @@ export class Cursor extends viewEvents.ViewEventEmitter implements ICursors {
this._emit([new viewEvents.ViewCursorStateChangedEvent(viewSelections, isInEditableRange)]);
// Only after the view has been notified, let the rest of the world know...
this._onDidChange.fire(new CursorStateChangedEvent(selections, source || 'keyboard', reason));
if (!oldState
|| oldState.cursorState.length !== newState.cursorState.length
|| newState.cursorState.some((newCursorState, i) => !newCursorState.modelState.equals(oldState.cursorState[i].modelState))
) {
this._onDidChange.fire(new CursorStateChangedEvent(selections, source || 'keyboard', reason));
}
return true;
}
......
......@@ -415,7 +415,7 @@ export class CursorState {
}
public equals(other: CursorState): boolean {
return (this.viewState.equals(other.viewState) && this.modelState.equals(other.viewState));
return (this.viewState.equals(other.viewState) && this.modelState.equals(other.modelState));
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册