fix #1239 on('changeScrollTop') argument is an object instead of number
This commit is contained in:
parent
c6ba1957aa
commit
2f55065e84
3 changed files with 34 additions and 33 deletions
|
|
@ -997,11 +997,11 @@ var EditSession = function(text, mode) {
|
|||
**/
|
||||
this.setScrollTop = function(scrollTop) {
|
||||
scrollTop = Math.round(Math.max(0, scrollTop));
|
||||
if (this.$scrollTop === scrollTop)
|
||||
if (this.$scrollTop === scrollTop || isNaN(scrollTop))
|
||||
return;
|
||||
|
||||
this.$scrollTop = scrollTop;
|
||||
this._emit("changeScrollTop", scrollTop);
|
||||
this._signal("changeScrollTop", scrollTop);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -1018,11 +1018,11 @@ var EditSession = function(text, mode) {
|
|||
**/
|
||||
this.setScrollLeft = function(scrollLeft) {
|
||||
scrollLeft = Math.round(Math.max(0, scrollLeft));
|
||||
if (this.$scrollLeft === scrollLeft)
|
||||
if (this.$scrollLeft === scrollLeft || isNaN(scrollLeft))
|
||||
return;
|
||||
|
||||
this.$scrollLeft = scrollLeft;
|
||||
this._emit("changeScrollLeft", scrollLeft);
|
||||
this._signal("changeScrollLeft", scrollLeft);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ var EditSession = require("./edit_session").EditSession;
|
|||
// automatically sorted list of ranges
|
||||
this.rangeList = null;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Adds a range to a selection by entering multiselect mode, if necessary.
|
||||
* @param {Range} range The new range to add
|
||||
* @param {Boolean} $blockChangeEvents Whether or not to block changing events
|
||||
|
|
@ -218,7 +218,7 @@ var EditSession = require("./edit_session").EditSession;
|
|||
var start = range.end, end = range.start;
|
||||
else
|
||||
var start = range.start, end = range.end;
|
||||
|
||||
|
||||
this.addRange(Range.fromPoints(end, end));
|
||||
this.addRange(Range.fromPoints(start, start));
|
||||
return;
|
||||
|
|
@ -261,9 +261,9 @@ var EditSession = require("./edit_session").EditSession;
|
|||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Gets list of ranges composing rectangular block on the screen
|
||||
*
|
||||
*
|
||||
* @param {Cursor} screenCursor The cursor to use
|
||||
* @param {Anchor} screenAnchor The anchor to use
|
||||
* @param {Boolean} includeEmptyLines If true, this includes ranges inside the block which are empty due to clipping
|
||||
|
|
@ -339,8 +339,8 @@ var EditSession = require("./edit_session").EditSession;
|
|||
var Editor = require("./editor").Editor;
|
||||
(function() {
|
||||
|
||||
/**
|
||||
*
|
||||
/**
|
||||
*
|
||||
* Updates the cursor and marker layers.
|
||||
* @method Editor.updateSelectionMarkers
|
||||
*
|
||||
|
|
@ -350,7 +350,7 @@ var Editor = require("./editor").Editor;
|
|||
this.renderer.updateBackMarkers();
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* Adds the selection and cursor.
|
||||
* @param {Range} orientedRange A range containing a cursor
|
||||
* @returns {Range}
|
||||
|
|
@ -368,7 +368,7 @@ var Editor = require("./editor").Editor;
|
|||
return orientedRange;
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* Removes the selection marker.
|
||||
* @param {Range} The selection range added with [[Editor.addSelectionMarker `addSelectionMarker()`]].
|
||||
* @method Editor.removeSelectionMarker
|
||||
|
|
@ -455,12 +455,12 @@ var Editor = require("./editor").Editor;
|
|||
e.preventDefault();
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* Executes a command for each selection range.
|
||||
* @param {String} cmd The command to execute
|
||||
* @param {String} args Any arguments for the command
|
||||
* @method Editor.forEachSelection
|
||||
**/
|
||||
**/
|
||||
this.forEachSelection = function(cmd, args) {
|
||||
if (this.inVirtualSelectionMode)
|
||||
return;
|
||||
|
|
@ -491,7 +491,7 @@ var Editor = require("./editor").Editor;
|
|||
this.onSelectionChange();
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* Removes all the selections except the last added one.
|
||||
* @method Editor.exitMultiSelectMode
|
||||
**/
|
||||
|
|
@ -522,7 +522,7 @@ var Editor = require("./editor").Editor;
|
|||
if (this.$readOnly)
|
||||
return;
|
||||
|
||||
this._emit("paste", text);
|
||||
this._signal("paste", text);
|
||||
if (!this.inMultiSelectMode || this.inVirtualSelectionMode)
|
||||
return this.insert(text);
|
||||
|
||||
|
|
@ -547,7 +547,7 @@ var Editor = require("./editor").Editor;
|
|||
* @param {Object} The search options
|
||||
* @param {Boolean} keeps
|
||||
*
|
||||
* @returns {Number} The cumulative count of all found matches
|
||||
* @returns {Number} The cumulative count of all found matches
|
||||
* @method Editor.findAll
|
||||
**/
|
||||
this.findAll = function(needle, options, additive) {
|
||||
|
|
@ -575,11 +575,11 @@ var Editor = require("./editor").Editor;
|
|||
|
||||
/**
|
||||
* Adds a cursor above or below the active cursor.
|
||||
*
|
||||
*
|
||||
* @param {Number} dir The direction of lines to select: -1 for up, 1 for down
|
||||
* @param {Boolean} skip If `true`, removes the active selection range
|
||||
*
|
||||
* @method Editor.selectMoreLines
|
||||
* @method Editor.selectMoreLines
|
||||
*/
|
||||
this.selectMoreLines = function(dir, skip) {
|
||||
var range = this.selection.toOrientedRange();
|
||||
|
|
@ -619,7 +619,7 @@ var Editor = require("./editor").Editor;
|
|||
this.selection.substractPoint(toRemove);
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* Transposes the selected ranges.
|
||||
* @param {Number} dir The direction to rotate selections
|
||||
* @method Editor.transposeSelections
|
||||
|
|
@ -661,7 +661,7 @@ var Editor = require("./editor").Editor;
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* Finds the next occurence of text in an active selection and adds it to the selections.
|
||||
* @param {Number} dir The direction of lines to select: -1 for up, 1 for down
|
||||
* @param {Boolean} skip If `true`, removes the active selection range
|
||||
|
|
@ -688,7 +688,7 @@ var Editor = require("./editor").Editor;
|
|||
this.multiSelect.substractPoint(range.cursor);
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* Aligns the cursors or selected text.
|
||||
* @method Editor.alignCursors
|
||||
**/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue