diff --git a/app/views/play/level/tome/SpellView.coffee b/app/views/play/level/tome/SpellView.coffee index 9c1892a34..54f3673cd 100644 --- a/app/views/play/level/tome/SpellView.coffee +++ b/app/views/play/level/tome/SpellView.coffee @@ -92,7 +92,7 @@ module.exports = class SpellView extends CocoView @aceSession.setNewLineMode 'unix' @aceSession.setUseSoftTabs true @ace.setTheme 'ace/theme/textmate' - @ace.setDisplayIndentGuides aceConfig.indentGuides + @ace.setDisplayIndentGuides false @ace.setShowPrintMargin false @ace.setShowInvisibles aceConfig.invisibles @ace.setBehavioursEnabled aceConfig.behaviors @@ -253,6 +253,7 @@ module.exports = class SpellView extends CocoView hookACECustomBehavior: -> + aceConfig = me.get('aceConfig') ? {} @ace.commands.on 'exec', (e) => # When pressing enter with an active selection, just make a new line under it. if e.command.name is 'enter-skip-delimiters' @@ -261,50 +262,45 @@ module.exports = class SpellView extends CocoView e.editor.execCommand 'gotolineend' return true - @aceSession.addDynamicMarker - update: (html, markerLayer, session, config) => - Range = ace.require('ace/range').Range + if me.level() < 20 or aceConfig.indentGuides + @aceSession.addDynamicMarker + update: (html, markerLayer, session, config) => + Range = ace.require('ace/range').Range - foldWidgets = @aceSession.foldWidgets - return if not foldWidgets? + foldWidgets = @aceSession.foldWidgets + return if not foldWidgets? - lines = @aceDoc.getAllLines() - startOfRow = (r) -> - str = lines[r] - ar = str.match(/^\s*/) - ar.pop().length + lines = @aceDoc.getAllLines() + startOfRow = (r) -> + str = lines[r] + ar = str.match(/^\s*/) + ar.pop().length - colors = ['50,150,200', '200,150,50', '255,0,0', '0,255,0'] + colors = ['50,150,200', '200,150,50', '255,0,0', '0,255,0'] - for row in [0..@aceSession.getLength()] - foldWidgets[row] = @aceSession.getFoldWidget(row) unless foldWidgets[row]? - - continue if foldWidgets[row] isnt "start" - range = @aceSession.getFoldWidgetRange(row) + for row in [0..@aceSession.getLength()] + foldWidgets[row] = @aceSession.getFoldWidget(row) unless foldWidgets[row]? - xstart = startOfRow(range.start.row) - level = Math.floor(xstart / 4) + continue if foldWidgets[row] isnt "start" + range = @aceSession.getFoldWidgetRange(row) + xstart = startOfRow(range.start.row) + level = Math.floor(xstart / 4) + indent = startOfRow(range.start.row + 1) + color = colors[level % colors.length] + t = markerLayer.$getTop(range.start.row + 1, config) + h = config.lineHeight * (range.end.row - range.start.row) + l = markerLayer.$padding + xstart * config.characterWidth + # w = (data.i - data.b) * config.characterWidth + w = 4 * config.characterWidth - data = - b: xstart - i: startOfRow(range.start.row + 1) - s: range.start.row, e: range.end.row, c: colors[level % colors.length] + html.push [ + '
' ].join '' - color = data.c - t = markerLayer.$getTop(data.s + 1, config) - h = config.lineHeight * (data.e - data.s) - l = markerLayer.$padding + data.b * config.characterWidth - # w = (data.i - data.b) * config.characterWidth - w = 4 * config.characterWidth - - html.push [ - '' ].join '' - - markerLayer.drawTextMarker html, new Range(data.s,data.b, data.s, 1000), 'rob', config, "border: 3px solid rgba(#{color}, 0.4); position: absolute" + markerLayer.drawTextMarker html, new Range(range.start.row,xstart, range.start.row, 1000), 'rob', config, "border: 3px solid rgba(#{color}, 0.4); position: absolute" fillACE: -> @ace.setValue @spell.source