From 60942b09a44ece04fad24824de98270a80614ab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Bartelme=C3=9F?= Date: Thu, 5 Apr 2012 01:07:47 +0200 Subject: fixing lineHasMarker --- src/static/js/AttributeManager.js | 14 +++++++++++--- src/static/js/ace2_inner.js | 4 ++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/static/js/AttributeManager.js b/src/static/js/AttributeManager.js index 5373a41d..6e3a2490 100644 --- a/src/static/js/AttributeManager.js +++ b/src/static/js/AttributeManager.js @@ -7,6 +7,10 @@ var AttributeManager = function(rep, applyChangesetCallback) this.rep = rep; this.applyChangesetCallback = applyChangesetCallback; this.author = ''; + + // If the first char in a line has one of the following attributes + // it will be considered as a line marker + this.lineAttributes = ['list']; }; AttributeManager.prototype = _(AttributeManager.prototype).extend({ @@ -21,7 +25,13 @@ AttributeManager.prototype = _(AttributeManager.prototype).extend({ lineHasMarker: function(lineNum){ // get "list" attribute of first char of line - return this.getAttributeOnLine(lineNum, 'list'); + var that = this; + + return _.find(this.lineAttributes, function(attribute){ + return that.getAttributeOnLine(lineNum, attribute) != ''; + }) !== undefined; + + }, getAttributeOnLine: function(lineNum, attributeName){ @@ -80,8 +90,6 @@ AttributeManager.prototype = _(AttributeManager.prototype).extend({ var builder = Changeset.builder(this.rep.lines.totalWidth()); var hasMarker = this.lineHasMarker(lineNum); - // TODO - if(hasMarker){ ChangesetUtils.buildKeepRange(this.rep, builder, loc, (loc = [lineNum, 0]), [ [attributeName, attributeValue] diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index 76992259..d4ae599a 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -3320,7 +3320,7 @@ function Ace2Inner(){ } _.each(mods, function(mod){ - setLineListType.apply(this, mod); + setLineListType(mod[0], mod[1]); }); return true; } @@ -4977,7 +4977,7 @@ function Ace2Inner(){ } _.each(mods, function(mod){ - setLineListType.apply(this, mod); + setLineListType(mod[0], mod[1]); }); } -- cgit v1.2.3