Merge branch 'fold-simplification' of github.com:github/atom into fold-simplification

This commit is contained in:
Corey Johnson
2012-05-21 13:45:07 -07:00
3 changed files with 11 additions and 12 deletions

View File

@@ -1,4 +1,4 @@
RootView = require 'root-view'
RootView = require 'root-view'
Buffer = require 'buffer'
Editor = require 'editor'
Range = require 'range'

View File

@@ -291,7 +291,7 @@ describe "Renderer", ->
changeHandler.reset()
describe "when a fold is nested within another fold", ->
fit "does not render the placeholder for the inner fold until the outer fold is destroyed", ->
it "does not render the placeholder for the inner fold until the outer fold is destroyed", ->
innerFold = renderer.createFold(6, 7)
outerFold = renderer.createFold(4, 8)
@@ -316,7 +316,7 @@ describe "Renderer", ->
expect(line6.screenDelta).toEqual [1, 0]
expect(line7.text).toBe '8'
fit "allows the outer fold to start at the same location as the inner fold", ->
it "allows the outer fold to start at the same location as the inner fold", ->
innerFold = renderer.createFold(4, 6)
outerFold = renderer.createFold(4, 8)

View File

@@ -461,18 +461,17 @@ class Editor extends View
charWidth = @charWidth
charHeight = @charHeight
lines = @renderer.linesForRows(startRow, endRow)
$$ ->
for line in lines
@div class: 'line', =>
appendNbsp = true
for token in line.tokens
if token.type is 'fold-placeholder'
@span ' ', class: 'fold-placeholder', style: "width: #{3 * charWidth}px; height: #{charHeight}px;", 'foldId': token.fold.id, =>
@div class: "ellipsis", => @raw "…"
else
appendNbsp = false
lineClass = 'line'
lineClass += ' fold' if line.fold?
@div class: lineClass, =>
if line.text == ''
@raw ' ' if line.text == ''
else
for token in line.tokens
@span { class: token.type.replace('.', ' ') }, token.value
@raw ' ' if appendNbsp
insertLineElements: (row, lineElements) ->
@spliceLineElements(row, 0, lineElements)