Merge branch 'Sphinxxxx-Sphinxxxx-patch-1'

This commit is contained in:
Jamie Peabody
2016-05-24 23:10:01 +01:00

View File

@@ -728,30 +728,35 @@ jQuery.extend(Mgly.CodeMirrorDiffView.prototype, {
sz(true);
}
this.editor[this.id + '-lhs'].on('gutterClick', function(cm, n) {
return $(this.changes).filter(function (i, change) {
if (n >= change['lhs-line-from'] && n <= change['lhs-line-to']) {
// scrollToDiff() from gutter
function gutterClicked(side, line, ev) {
// The "Merge left/right" buttons are also located in the gutter.
// Don't interfere with them:
if(ev.target && (ev.target.parentNode.className.indexOf('merge-button') >= 0)) {
return;
}
// See if the user clicked the line number of a difference:
var i, change;
for (i = 0; i < this.changes.length; i++) {
change = this.changes[i];
if (line >= change[side+'-line-from'] && line <= change[side+'-line-to']) {
this._current_diff = i;
return true;
// I really don't like this here - something about gutterClick does not
// like mutating editor here. Need to trigger the scroll to diff from
// a timeout.
setTimeout(function() { this.scrollToDiff(); }.bind(this), 10);
break;
}
}.bind(this));
// I really don't like this here - something about gutterClick does not
// like mutating editor here. Need to trigger the scroll to diff from
// a timeout.
setTimeout(function() { this.scrollToDiff(); }.bind(this), 10);
}
}
this.editor[this.id + '-lhs'].on('gutterClick', function(cm, n, gutterClass, ev) {
gutterClicked.call(this, 'lhs', n, ev);
}.bind(this));
this.editor[this.id + '-rhs'].on('gutterClick', function(cm, n) {
$(this.changes).filter(function (i, change) {
if (n >= change['rhs-line-from'] && n <= change['rhs-line-to']) {
this._current_diff = i;
return true;
}
}.bind(this));
// I really don't like this here - something about gutterClick does not
// like mutating editor here. Need to trigger the scroll to diff from
// a timeout.
setTimeout(function() { this.scrollToDiff(); }.bind(this), 10);
this.editor[this.id + '-rhs'].on('gutterClick', function(cm, n, gutterClass, ev) {
gutterClicked.call(this, 'rhs', n, ev);
}.bind(this));
//bind
@@ -1315,7 +1320,7 @@ jQuery.extend(Mgly.CodeMirrorDiffView.prototype, {
// merge buttons
var ed = {lhs:led, rhs:red};
jQuery('.merge-button').on('click', function(ev){
this.element.find('.merge-button').on('click', function(ev){
// side of mouseenter
var side = 'rhs';
var oside = 'lhs';