From 8c4c10474706710224352fa3799c69c78dec3b2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20D=C3=B6rbandt?= Date: Sun, 22 Oct 2023 17:46:22 +0200 Subject: [PATCH] Handle resolution clicks with no lines --- .../conflictIntervalAndResolutionSurrounding.in..st | 12 ++++++------ .../methodProperties.json | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Squot.package/SquotCodeConflictChange.class/instance/conflictIntervalAndResolutionSurrounding.in..st b/src/Squot.package/SquotCodeConflictChange.class/instance/conflictIntervalAndResolutionSurrounding.in..st index 3462951f9..b96cebc30 100644 --- a/src/Squot.package/SquotCodeConflictChange.class/instance/conflictIntervalAndResolutionSurrounding.in..st +++ b/src/Squot.package/SquotCodeConflictChange.class/instance/conflictIntervalAndResolutionSurrounding.in..st @@ -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. diff --git a/src/Squot.package/SquotCodeConflictChange.class/methodProperties.json b/src/Squot.package/SquotCodeConflictChange.class/methodProperties.json index 6ecdc2aed..bd6a48f14 100644 --- a/src/Squot.package/SquotCodeConflictChange.class/methodProperties.json +++ b/src/Squot.package/SquotCodeConflictChange.class/methodProperties.json @@ -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",