Folds can start at the beginning of a line

This commit is contained in:
Nathan Sobo
2012-02-28 19:02:26 -07:00
parent 65c7a6126e
commit da53eeb80d
2 changed files with 7 additions and 2 deletions

View File

@@ -173,6 +173,11 @@ describe "LineFolder", ->
expect(event.oldRange).toEqual [[7, 0], [7, 28]]
expect(event.newRange).toEqual [[7, 0], [8, 56]]
describe "when the fold is at the beginning of the line", ->
it "renders a placeholder at the beginning of the line", ->
folder.createFold(new Range([4, 0], [7, 4]))
expect(folder.lineForScreenRow(4).text).toBe '...}'
describe "when the buffer changes", ->
[fold1, fold2] = []
beforeEach ->

View File

@@ -95,10 +95,10 @@ class LineFolder
screenLine = @highlighter.lineForScreenRow(bufferRow).splitAt(startColumn)[1]
for fold in @foldsForBufferRow(bufferRow)
{ start, end } = fold.getRange()
if start.column > startColumn
if start.column >= startColumn
prefix = screenLine.splitAt(start.column - startColumn)[0]
suffix = @buildLineForBufferRow(end.row, end.column)
return _.flatten([prefix, @buildFoldPlaceholder(fold), suffix])
return _.compact(_.flatten([prefix, @buildFoldPlaceholder(fold), suffix]))
screenLine
buildFoldPlaceholder: (fold) ->