mirror of
https://github.com/voideditor/void
synced 2026-05-24 09:58:23 +00:00
fix rounding
This commit is contained in:
parent
372beb7a2d
commit
ffe5a41b01
1 changed files with 9 additions and 2 deletions
|
|
@ -890,8 +890,15 @@ Please finish writing the new file by applying the diff to the original file. Re
|
|||
// |B <-- deleted here, diff.startLine == diff.endLine
|
||||
// C
|
||||
if (diff.type === 'deletion') {
|
||||
writeText = diff.originalCode + '\n'
|
||||
toRange = { startLineNumber: diff.startLine, startColumn: 1, endLineNumber: diff.startLine, endColumn: 1 }
|
||||
// if startLine is out of bounds (deleted lines past the diffarea), applyEdit will do a weird rounding thing, to account for that we apply the edit the line before
|
||||
if (diff.startLine - 1 === diffArea.endLine) {
|
||||
writeText = '\n' + diff.originalCode
|
||||
toRange = { startLineNumber: diff.startLine - 1, startColumn: Number.MAX_SAFE_INTEGER, endLineNumber: diff.startLine - 1, endColumn: Number.MAX_SAFE_INTEGER }
|
||||
}
|
||||
else {
|
||||
writeText = diff.originalCode + '\n'
|
||||
toRange = { startLineNumber: diff.startLine, startColumn: 1, endLineNumber: diff.startLine, endColumn: 1 }
|
||||
}
|
||||
}
|
||||
// if it was an insertion, need to delete all the lines
|
||||
// (this image applies to writeText and toRange, not newOriginalCode)
|
||||
|
|
|
|||
Loading…
Reference in a new issue