Commit aed789d3 authored by rockyl's avatar rockyl

修复冲突合并的bug

parent cf4b7476
...@@ -348,7 +348,7 @@ ...@@ -348,7 +348,7 @@
//console.log(merged); //console.log(merged);
let startLine = modifiedStartLineNumber + offset; let startLine = modifiedStartLineNumber + offset + (modifiedEndLineNumber === 0 ? 1 : 0);
mergedCodeLines.splice(startLine - 1, modifiedEndLineNumber - modifiedStartLineNumber + 1, ...merged); mergedCodeLines.splice(startLine - 1, modifiedEndLineNumber - modifiedStartLineNumber + 1, ...merged);
offset += 3 + remotePart.length; offset += 3 + remotePart.length;
} }
...@@ -387,10 +387,11 @@ ...@@ -387,10 +387,11 @@
} }
break; break;
} }
if (replacer !== undefined) { /*if (replacer !== undefined) {
replaceText(replacer); replaceText(replacer);
//this.localData = lines.join('\n'); //this.localData = lines.join('\n');
} }*/
replaceText(replacer);
this.delayTrack(); this.delayTrack();
this.conflictIndex--; this.conflictIndex--;
...@@ -404,18 +405,25 @@ ...@@ -404,18 +405,25 @@
} }
return resultLines.join('\n'); return resultLines.join('\n');
} }
return null;
} }
function replaceText(replacer) { function replaceText(replacer) {
model.pushEditOperations([], [{ let op = {
range: { range: {
startLineNumber: conflict.remoteLine + 1, startLineNumber: conflict.remoteLine + 1,
startColumn: 0, startColumn: 1,
endLineNumber: conflict.localLine + 1, endLineNumber: conflict.localLine + 1,
endColumn: Number.MAX_VALUE, endColumn: Number.MAX_VALUE,
}, },
text: replacer, text: replacer,
}], () => []); };
if (replacer === null) {
op.range.startLineNumber = conflict.remoteLine;
op.range.startColumn = Number.MAX_VALUE;
}
model.pushEditOperations([], [op], () => []);
} }
}, },
...mapMutations([ ...mapMutations([
......
...@@ -8703,7 +8703,7 @@ vue-loader@^15.7.0: ...@@ -8703,7 +8703,7 @@ vue-loader@^15.7.0:
"vue-monaco@http://gitlab2.dui88.com/laoqifeng/vue-monaco.git": "vue-monaco@http://gitlab2.dui88.com/laoqifeng/vue-monaco.git":
version "0.3.1" version "0.3.1"
resolved "http://gitlab2.dui88.com/laoqifeng/vue-monaco.git#13de23ce8ba73525cf08678227ae0c579fe2319d" resolved "http://gitlab2.dui88.com/laoqifeng/vue-monaco.git#d8153f9d3f41eee09a7a0c05212333dea5c86712"
dependencies: dependencies:
monaco-editor "^0.20.0" monaco-editor "^0.20.0"
nano-assign "^1.0.0" nano-assign "^1.0.0"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment