adds setWrapLimit to session
This commit is contained in:
parent
340f004fd0
commit
b0c08dced1
2 changed files with 12 additions and 7 deletions
|
|
@ -1612,7 +1612,18 @@ var EditSession = function(text, mode) {
|
||||||
this.getWrapLimit = function() {
|
this.getWrapLimit = function() {
|
||||||
return this.$wrapLimit;
|
return this.$wrapLimit;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the line length for soft wrap in the editor. Lines will break
|
||||||
|
* at a minimum of the given length minus 20 chars and at a maximum
|
||||||
|
* of the given number of chars.
|
||||||
|
* @param {number} limit The maximum line length in chars, for soft
|
||||||
|
* wrapping lines.
|
||||||
|
*/
|
||||||
|
this.setWrapLimit = function (limit) {
|
||||||
|
this.setWrapLimitRange(limit - 20, limit);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an object that defines the minimum and maximum of the wrap limit; it looks something like this:
|
* Returns an object that defines the minimum and maximum of the wrap limit; it looks something like this:
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -69,12 +69,6 @@ define(function(require, exports, module) {
|
||||||
function addFunctionsForSettingsMenu (editor) {
|
function addFunctionsForSettingsMenu (editor) {
|
||||||
// when building the settings menu matching get and set functions
|
// when building the settings menu matching get and set functions
|
||||||
// must be found or the function will be ignored
|
// must be found or the function will be ignored
|
||||||
|
|
||||||
// this allows the settings menu to supply a wrap limit
|
|
||||||
// using a text input field easily
|
|
||||||
editor.session.setWrapLimit = function (limit) {
|
|
||||||
editor.session.setWrapLimitRange(limit - 20, limit);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Generates a list of set functions for the settings menu.
|
* Generates a list of set functions for the settings menu.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue