issue-69: invalidates current set of changes before editor content is replaced
This commit is contained in:
@@ -484,9 +484,11 @@ jQuery.extend(Mgly.CodeMirrorDiffView.prototype, {
|
||||
this.unbind();
|
||||
},
|
||||
lhs: function(text) {
|
||||
this.changes = []; // invalidate existing changes
|
||||
this.editor[this.id + '-lhs'].setValue(text);
|
||||
},
|
||||
rhs: function(text) {
|
||||
this.changes = []; // invalidate existing changes
|
||||
this.editor[this.id + '-rhs'].setValue(text);
|
||||
},
|
||||
update: function() {
|
||||
@@ -796,7 +798,9 @@ jQuery.extend(Mgly.CodeMirrorDiffView.prototype, {
|
||||
// set cursors
|
||||
led.setCursor(Math.max(change["lhs-line-from"],0), 0); // use led.getCursor().ch ?
|
||||
red.setCursor(Math.max(change["rhs-line-from"],0), 0);
|
||||
led.scrollIntoView({line: change["lhs-line-to"]});
|
||||
if (change["lhs-line-to"] >= 0) {
|
||||
led.scrollIntoView({line: change["lhs-line-to"]});
|
||||
}
|
||||
},
|
||||
|
||||
_scrolling: function(editor_name) {
|
||||
@@ -1173,6 +1177,9 @@ jQuery.extend(Mgly.CodeMirrorDiffView.prototype, {
|
||||
var clazz = ['mergely', 'lhs', change['op'], 'cid-' + i];
|
||||
led.addLineClass(llf, 'background', 'start');
|
||||
led.addLineClass(llt, 'background', 'end');
|
||||
if (change['lhs-line-from'] < 0) {
|
||||
clazz.push('empty');
|
||||
}
|
||||
|
||||
if (current_diff == i) {
|
||||
if (llf != llt) {
|
||||
@@ -1225,6 +1232,9 @@ jQuery.extend(Mgly.CodeMirrorDiffView.prototype, {
|
||||
var clazz = ['mergely', 'rhs', change['op'], 'cid-' + i];
|
||||
red.addLineClass(rlf, 'background', 'start');
|
||||
red.addLineClass(rlt, 'background', 'end');
|
||||
if (change['rhs-line-from'] < 0) {
|
||||
clazz.push('empty');
|
||||
}
|
||||
|
||||
if (current_diff == i) {
|
||||
if (rlf != rlt) {
|
||||
|
||||
Reference in New Issue
Block a user