Skip to content

Commit

Permalink
Handle resolution clicks with no lines
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusDoe committed Oct 22, 2023
1 parent b12d4b9 commit 8c4c104
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ conflictIntervalAndResolutionSurrounding: lineIndex in: source
ifTrue: [resolutionStart := nextLineStart]
ifFalse: [resolutionEnd ifNil: [resolutionEnd := previousLineEnd]]].
(line beginsWith: self conflictMarkerRight) ifTrue: [
lineIndex <= currentLineIndex ifTrue: [ | conflictEnd conflictInterval resolution newLine |
lineIndex <= currentLineIndex ifTrue: [ | conflictEnd conflictInterval resolution |
conflictStart ifNil: [^ nil].
self assert: (conflictStart notNil and: [resolutionStart notNil]).
conflictEnd := endIndexWithDelimiter.
conflictEnd := endIndexWithoutDelimiter.
resolutionEnd ifNil: [resolutionEnd := previousLineEnd].
resolution := resolutionStart - 1 <= resolutionEnd "- 1 to allow for a single empty line"
ifTrue: [source copyFrom: resolutionStart to: resolutionEnd]
"if there is no line, remove the line end after the conflict, too"
ifFalse: [conflictEnd := endIndexWithDelimiter. ''].
conflictInterval := Interval from: conflictStart to: conflictEnd.
resolution := source copyFrom: resolutionStart to: resolutionEnd.
"resolution is missing a new line at the end. Add it from the conflictMarkerRight line, if there is one."
newLine := source copyFrom: endIndexWithoutDelimiter + 1 to: endIndexWithDelimiter.
resolution := resolution, newLine.
^ conflictInterval -> resolution].
conflictStart := nil.
resolutionStart := nil.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"buildWith:" : "mad 9/14/2023 14:17",
"conflict" : "mad 9/7/2023 19:47",
"conflict:" : "mad 9/7/2023 19:49",
"conflictIntervalAndResolutionSurrounding:in:" : "mad 9/26/2023 16:21",
"conflictIntervalAndResolutionSurrounding:in:" : "mad 10/22/2023 17:45",
"conflictLines:on:" : "mad 9/10/2023 18:34",
"conflictMarkerBase" : "mad 9/10/2023 13:24",
"conflictMarkerLeft" : "mad 9/10/2023 13:24",
Expand Down

0 comments on commit 8c4c104

Please sign in to comment.