mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 21:55:38 +00:00
💄
This commit is contained in:
parent
579b962ae1
commit
507a3508a5
|
@ -13,17 +13,18 @@ export function applyLineChanges(original: TextDocument, modified: TextDocument,
|
|||
const isInsertion = diff.originalEndLineNumber === 0;
|
||||
const isDeletion = diff.modifiedEndLineNumber === 0;
|
||||
|
||||
let toCharacter = 0;
|
||||
let toLine = isInsertion ? diff.originalStartLineNumber : diff.originalStartLineNumber - 1;
|
||||
let endLine = isInsertion ? diff.originalStartLineNumber : diff.originalStartLineNumber - 1;
|
||||
let endCharacter = 0;
|
||||
|
||||
// if this is a deletion at the very end of the document,then we need to account
|
||||
// for a newline at the end of the last line which may have been deleted
|
||||
// https://github.com/Microsoft/vscode/issues/59670
|
||||
if (isDeletion && diff.originalStartLineNumber === original.lineCount) {
|
||||
toLine -= 1;
|
||||
toCharacter = original.lineAt(toLine).range.end.character;
|
||||
endLine -= 1;
|
||||
endCharacter = original.lineAt(endLine).range.end.character;
|
||||
}
|
||||
|
||||
result.push(original.getText(new Range(currentLine, 0, toLine, toCharacter)));
|
||||
result.push(original.getText(new Range(currentLine, 0, endLine, endCharacter)));
|
||||
|
||||
if (!isDeletion) {
|
||||
let fromLine = diff.modifiedStartLineNumber - 1;
|
||||
|
|
Loading…
Reference in a new issue