Merge pull request #70 from wickedest/issue-69
issue-69: invalidates changes before editor content is replaced
This commit is contained in:
@@ -18,12 +18,12 @@
|
|||||||
.mergely.a.lhs.start.end,
|
.mergely.a.lhs.start.end,
|
||||||
.mergely.a.rhs.end { border-bottom: 1px solid #a3d1ff; }
|
.mergely.a.rhs.end { border-bottom: 1px solid #a3d1ff; }
|
||||||
.mergely.a.rhs { background-color: #ddeeff; }
|
.mergely.a.rhs { background-color: #ddeeff; }
|
||||||
.mergely.a.lhs.start.end.first { border-bottom: 0; border-top: 1px solid #a3d1ff; }
|
.mergely.a.lhs.start.end.first { border-bottom-width: 0; border-top: 1px solid #a3d1ff; }
|
||||||
|
|
||||||
.mergely.d.lhs { background-color: #ffe9e9; }
|
.mergely.d.lhs { background-color: #ffe9e9; }
|
||||||
.mergely.d.lhs.end,
|
.mergely.d.lhs.end,
|
||||||
.mergely.d.rhs.start.end { border-bottom: 1px solid #f8e8e8; }
|
.mergely.d.rhs.start.end { border-bottom: 1px solid #f8e8e8; }
|
||||||
.mergely.d.rhs.start.end.first { border-bottom: 0; border-top: 1px solid #f8e8e8; }
|
.mergely.d.rhs.start.end.first { border-bottom-width: 0; border-top: 1px solid #f8e8e8; }
|
||||||
.mergely.d.lhs.start { border-top: 1px solid #f8e8e8; }
|
.mergely.d.lhs.start { border-top: 1px solid #f8e8e8; }
|
||||||
|
|
||||||
.mergely.c.lhs,
|
.mergely.c.lhs,
|
||||||
@@ -39,7 +39,11 @@
|
|||||||
.mergely.current.start { border-top: 1px solid #000 !important; }
|
.mergely.current.start { border-top: 1px solid #000 !important; }
|
||||||
.mergely.current.end { border-bottom: 1px solid #000 !important; }
|
.mergely.current.end { border-bottom: 1px solid #000 !important; }
|
||||||
.mergely.current.lhs.a.start.end,
|
.mergely.current.lhs.a.start.end,
|
||||||
.mergely.current.rhs.d.start.end { border-top: 0 !important; }
|
.mergely.current.rhs.d.start.end { border-top-width: 0 !important; }
|
||||||
|
|
||||||
|
.mergely.current.lhs.a.start.end.empty,
|
||||||
|
.mergely.current.rhs.d.start.end.empty { border-top-width: 1px !important; border-bottom-width: 0px !important; }
|
||||||
|
|
||||||
.mergely.current.CodeMirror-linenumber { color: #F9F9F9; font-weight: bold; background-color: #777; }
|
.mergely.current.CodeMirror-linenumber { color: #F9F9F9; font-weight: bold; background-color: #777; }
|
||||||
.CodeMirror-linenumber { cursor: pointer; }
|
.CodeMirror-linenumber { cursor: pointer; }
|
||||||
.CodeMirror-code { color: #717171; }
|
.CodeMirror-code { color: #717171; }
|
||||||
|
|||||||
@@ -484,9 +484,11 @@ jQuery.extend(Mgly.CodeMirrorDiffView.prototype, {
|
|||||||
this.unbind();
|
this.unbind();
|
||||||
},
|
},
|
||||||
lhs: function(text) {
|
lhs: function(text) {
|
||||||
|
this.changes = []; // invalidate existing changes
|
||||||
this.editor[this.id + '-lhs'].setValue(text);
|
this.editor[this.id + '-lhs'].setValue(text);
|
||||||
},
|
},
|
||||||
rhs: function(text) {
|
rhs: function(text) {
|
||||||
|
this.changes = []; // invalidate existing changes
|
||||||
this.editor[this.id + '-rhs'].setValue(text);
|
this.editor[this.id + '-rhs'].setValue(text);
|
||||||
},
|
},
|
||||||
update: function() {
|
update: function() {
|
||||||
@@ -796,7 +798,9 @@ jQuery.extend(Mgly.CodeMirrorDiffView.prototype, {
|
|||||||
// set cursors
|
// set cursors
|
||||||
led.setCursor(Math.max(change["lhs-line-from"],0), 0); // use led.getCursor().ch ?
|
led.setCursor(Math.max(change["lhs-line-from"],0), 0); // use led.getCursor().ch ?
|
||||||
red.setCursor(Math.max(change["rhs-line-from"],0), 0);
|
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) {
|
_scrolling: function(editor_name) {
|
||||||
@@ -1173,6 +1177,9 @@ jQuery.extend(Mgly.CodeMirrorDiffView.prototype, {
|
|||||||
var clazz = ['mergely', 'lhs', change['op'], 'cid-' + i];
|
var clazz = ['mergely', 'lhs', change['op'], 'cid-' + i];
|
||||||
led.addLineClass(llf, 'background', 'start');
|
led.addLineClass(llf, 'background', 'start');
|
||||||
led.addLineClass(llt, 'background', 'end');
|
led.addLineClass(llt, 'background', 'end');
|
||||||
|
if (change['lhs-line-from'] < 0) {
|
||||||
|
clazz.push('empty');
|
||||||
|
}
|
||||||
|
|
||||||
if (current_diff == i) {
|
if (current_diff == i) {
|
||||||
if (llf != llt) {
|
if (llf != llt) {
|
||||||
@@ -1225,6 +1232,9 @@ jQuery.extend(Mgly.CodeMirrorDiffView.prototype, {
|
|||||||
var clazz = ['mergely', 'rhs', change['op'], 'cid-' + i];
|
var clazz = ['mergely', 'rhs', change['op'], 'cid-' + i];
|
||||||
red.addLineClass(rlf, 'background', 'start');
|
red.addLineClass(rlf, 'background', 'start');
|
||||||
red.addLineClass(rlt, 'background', 'end');
|
red.addLineClass(rlt, 'background', 'end');
|
||||||
|
if (change['rhs-line-from'] < 0) {
|
||||||
|
clazz.push('empty');
|
||||||
|
}
|
||||||
|
|
||||||
if (current_diff == i) {
|
if (current_diff == i) {
|
||||||
if (rlf != rlt) {
|
if (rlf != rlt) {
|
||||||
|
|||||||
Reference in New Issue
Block a user