提交 22ab03e7 编写于 作者: R Rachel Macfarlane

Prevent comment ranges from shifting on edit

上级 5bab8f68
......@@ -299,24 +299,6 @@ export class ReviewZoneWidget extends ZoneWidget {
this._localToDispose.push(this.editor.onMouseDown(e => this.onEditorMouseDown(e)));
this._localToDispose.push(this.editor.onMouseUp(e => this.onEditorMouseUp(e)));
this._localToDispose.push(this.editor.onDidChangeModelContent((e) => {
// If the widget has been opened, the position is set and can be relied on for updating the glyph position
if (this.position) {
if (this.position.lineNumber !== this._commentGlyph.getPosition().position.lineNumber) {
this._commentGlyph.setLineNumber(this.position.lineNumber);
}
} else {
// Otherwise manually calculate position change :(
const positionChange = e.changes.map(change => {
if (change.range.startLineNumber < change.range.endLineNumber) {
return change.range.startLineNumber - change.range.endLineNumber;
} else {
return change.text.split(e.eol).length - 1;
}
}).reduce((prev, curr) => prev + curr, 0);
this._commentGlyph.setLineNumber(this._commentGlyph.getPosition().position.lineNumber + positionChange);
}
}));
var headHeight = Math.ceil(this.editor.getConfiguration().lineHeight * 1.2);
this._headElement.style.height = `${headHeight}px`;
this._headElement.style.lineHeight = this._headElement.style.height;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册