do not store copy of breakpoints array in gutter

This commit is contained in:
nightwing 2012-05-19 20:38:09 +04:00
commit 31729a963a
4 changed files with 7 additions and 12 deletions

View file

@ -570,7 +570,7 @@ var Editor = function(renderer, session) {
* Emitted when a breakpoint changes.
**/
this.onChangeBreakpoint = function() {
this.renderer.setBreakpoints(this.session.getBreakpoints());
this.renderer.updateBreakpoints();
};
/**

View file

@ -75,10 +75,6 @@ var Gutter = function(parentEl) {
this.$decorations[row] = (this.$decorations[row] || "").replace(" " + className, "");
};
this.setBreakpoints = function(rows) {
this.$breakpoints = rows.concat();
};
this.setAnnotations = function(annotations) {
// iterate over sparse array
this.$annotations = [];
@ -116,6 +112,7 @@ var Gutter = function(parentEl) {
var fold = this.session.getNextFoldLine(i);
var foldStart = fold ? fold.start.row : Infinity;
var foldWidgets = this.$showFoldWidgets && this.session.foldWidgets;
var breakpoints = this.session.$breakpoints;
while (true) {
if(i > foldStart) {
@ -129,7 +126,7 @@ var Gutter = function(parentEl) {
var annotation = this.$annotations[i] || emptyAnno;
html.push("<div class='ace_gutter-cell",
this.$decorations[i] || "",
this.$breakpoints[i] ? " ace_breakpoint " : " ",
breakpoints[i] ? " ace_breakpoint " : " ",
annotation.className,
"' title='", annotation.text.join("\n"),
"' style='height:", this.session.getRowLength(i) * config.lineHeight, "px;'>", (i+1));

View file

@ -163,7 +163,7 @@ MockRenderer.prototype.updateBackMarkers = function() {
MockRenderer.prototype.updateFrontMarkers = function() {
};
MockRenderer.prototype.setBreakpoints = function() {
MockRenderer.prototype.updateBreakpoints = function() {
};
MockRenderer.prototype.onResize = function() {

View file

@ -889,13 +889,11 @@ var VirtualRenderer = function(container, theme) {
};
/**
* VirtualRenderer.setBreakpoints(rows) -> Void
* - rows (Array): An array containg row numbers
* VirtualRenderer.updateBreakpoints() -> Void
*
* Sets a breakpoint for every row number indicated on `rows`.
* Redraw breakpoints.
**/
this.setBreakpoints = function(rows) {
this.$gutterLayer.setBreakpoints(rows);
this.updateBreakpoints = function(rows) {
this.$loop.schedule(this.CHANGE_GUTTER);
};