mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-22 19:55:11 +00:00
Issue 1676: Don't eat up the last newline in a multi-line replacement (#1777)
This commit is contained in:
parent
6c30565d40
commit
8db75266d0
1 changed files with 4 additions and 1 deletions
|
|
@ -188,7 +188,10 @@ export const LineTrimmedReplacer: Replacer = function* (content, find) {
|
|||
|
||||
let matchEndIndex = matchStartIndex
|
||||
for (let k = 0; k < searchLines.length; k++) {
|
||||
matchEndIndex += originalLines[i + k].length + 1
|
||||
matchEndIndex += originalLines[i + k].length
|
||||
if (k < searchLines.length - 1) {
|
||||
matchEndIndex += 1 // Add newline character except for the last line
|
||||
}
|
||||
}
|
||||
|
||||
yield content.substring(matchStartIndex, matchEndIndex)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue