move gutterDecorations to session

This commit is contained in:
nightwing 2012-07-28 17:38:04 +04:00
commit 599c540c20
3 changed files with 42 additions and 21 deletions

View file

@ -72,6 +72,7 @@ var SearchHighlight = require("./search_highlight").SearchHighlight;
var EditSession = function(text, mode) {
this.$modified = true;
this.$breakpoints = [];
this.$decorations = [];
this.$frontMarkers = {};
this.$backMarkers = {};
this.$markerId = 1;
@ -489,7 +490,33 @@ var EditSession = function(text, mode) {
this.toggleOverwrite = function() {
this.setOverwrite(!this.$overwrite);
};
/**
* EditSession.addGutterDecoration(row, className) -> Void
* - row (Number): The row number
* - className (String): The class to add
*
* Adds `className` to the `row`, to be used for CSS stylings and whatnot.
**/
this.addGutterDecoration = function(row, className) {
if (!this.$decorations[row])
this.$decorations[row] = "";
this.$decorations[row] += " " + className;
this._emit("changeBreakpoint", {});
};
/**
* EditSession.removeGutterDecoration(row, className)-> Void
* - row (Number): The row number
* - className (String): The class to add
*
* Removes `className` from the `row`.
**/
this.removeGutterDecoration = function(row, className) {
this.$decorations[row] = (this.$decorations[row] || "").replace(" " + className, "");
this._emit("changeBreakpoint", {});
};
/**
* EditSession.getBreakpoints() -> Array
*