This commit is contained in:
nightwing 2013-02-23 23:37:00 +04:00
commit bf2015bf7e

View file

@ -44,15 +44,13 @@ var SearchHighlight = require("./search_highlight").SearchHighlight;
var config = require("./config");
/**
*
*
* Stores all the data about [[Editor `Editor`]] state providing easy way to change editors state.
*
* `EditSession` can be attached to only one [[Document `Document`]]. Same `Document` can be attached to several `EditSession`s.
* @class EditSession
**/
// events
//{ events
/**
*
* Emitted when the document changes.
@ -132,7 +130,7 @@ var config = require("./config");
*
* @param {Number} scrollLeft The new scroll left value
**/
//}
/**
*
@ -153,11 +151,7 @@ var EditSession = function(text, mode) {
this.$foldData = [];
this.$foldData.toString = function() {
var str = "";
this.forEach(function(foldLine) {
str += "\n" + foldLine.toString();
});
return str;
return this.join("\n");
}
this.on("changeFold", this.onChangeFold.bind(this));
this.$onChange = this.onChange.bind(this);
@ -958,7 +952,6 @@ var EditSession = function(text, mode) {
this.$worker = null;
};
this.$startWorker = function() {
if (typeof Worker !== "undefined" && !require.noWorker) {
try {
@ -1210,7 +1203,7 @@ var EditSession = function(text, mode) {
this.$getUndoSelection = function(deltas, isUndo, lastUndoRange) {
function isInsert(delta) {
var insert =
delta.action == "insertText" || delta.action == "insertLines";
delta.action === "insertText" || delta.action === "insertLines";
return isUndo ? !insert : insert;
}
@ -2381,9 +2374,9 @@ config.defineOptions(EditSession.prototype, "session", {
if (!value) {
this.setUseWrapMode(false);
} else {
var col = typeof value == "number" && value;
var col = typeof value == "number" ? value : null;
this.setUseWrapMode(true);
this.setWrapLimitRange(value, value);
this.setWrapLimitRange(col, col);
}
this.$wrap = value;
},