Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ee9c005

Browse files
committed
Don't consider banners and separators "modified" if the NL is missing
1 parent 1df6ce6 commit ee9c005

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib/models/conflicts/banner.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ export default class Banner {
1717
}
1818

1919
isModified() {
20-
return this.editor.getTextInBufferRange(this.marker.getBufferRange()) !== this.originalText;
20+
const chomp = line => line.replace(/\r?\n$/, '');
21+
22+
const text = this.editor.getTextInBufferRange(this.marker.getBufferRange());
23+
return chomp(text) !== chomp(this.originalText);
2124
}
2225

2326
revert() {

lib/models/conflicts/separator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ export default class Separator {
1616

1717
isModified() {
1818
const currentText = this.editor.getTextInBufferRange(this.getMarker().getBufferRange());
19-
return !/^=======\r?\n/.test(currentText);
19+
return !/^=======\r?\n?$/.test(currentText);
2020
}
2121
}

0 commit comments

Comments
 (0)