mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-24 08:08:15 -05:00
Fix visual indents when document row doesn't match screen row.
This commit is contained in:
parent
ce92f11b27
commit
db060e9816
1 changed files with 12 additions and 7 deletions
|
@ -263,6 +263,7 @@ module.exports = class SpellView extends CocoView
|
|||
return true
|
||||
|
||||
if me.level() < 20 or aceConfig.indentGuides
|
||||
# Add visual ident guides
|
||||
@aceSession.addDynamicMarker
|
||||
update: (html, markerLayer, session, config) =>
|
||||
Range = ace.require('ace/range').Range
|
||||
|
@ -281,17 +282,21 @@ module.exports = class SpellView extends CocoView
|
|||
for row in [0..@aceSession.getLength()]
|
||||
foldWidgets[row] = @aceSession.getFoldWidget(row) unless foldWidgets[row]?
|
||||
continue unless foldWidgets? and foldWidgets[row] is "start"
|
||||
range = @aceSession.getFoldWidgetRange(row)
|
||||
if not range?
|
||||
docRange = @aceSession.getFoldWidgetRange(row)
|
||||
if not docRange?
|
||||
guess = startOfRow(row)
|
||||
range = new Range(row,guess,row,guess+4)
|
||||
docRange = new Range(row,guess,row,guess+4)
|
||||
|
||||
if /^\s+$/.test lines[range.end.row+1]
|
||||
range.end.row += 1
|
||||
if /^\s+$/.test lines[docRange.end.row+1]
|
||||
docRange.end.row += 1
|
||||
|
||||
xstart = startOfRow(range.start.row)
|
||||
rstart = @aceSession.documentToScreenPosition docRange.start.row, docRange.start.column
|
||||
rend = @aceSession.documentToScreenPosition docRange.end.row, docRange.end.column
|
||||
range = new Range rstart.row, rstart.column, rend.row, rend.column
|
||||
|
||||
xstart = startOfRow(row)
|
||||
level = Math.floor(xstart / 4)
|
||||
indent = startOfRow(range.start.row + 1)
|
||||
indent = startOfRow(row + 1)
|
||||
color = colors[level % colors.length]
|
||||
t = markerLayer.$getTop(range.start.row + 1, config)
|
||||
h = config.lineHeight * (range.end.row - range.start.row)
|
||||
|
|
Loading…
Reference in a new issue