diff --git a/spec/atom/renderer-spec.coffee b/spec/atom/renderer-spec.coffee index 7a3acf3a7..fe7dded0b 100644 --- a/spec/atom/renderer-spec.coffee +++ b/spec/atom/renderer-spec.coffee @@ -1,7 +1,7 @@ Renderer = require 'renderer' Buffer = require 'buffer' -fdescribe "Renderer", -> +describe "Renderer", -> [renderer, buffer, changeHandler] = [] beforeEach -> buffer = new Buffer(require.resolve 'fixtures/sample.js') @@ -55,6 +55,12 @@ fdescribe "Renderer", -> expect(renderer.lineForRow(7).text).toBe 'ht));' expect(renderer.lineForRow(8).text).toBe ' };' + describe "when there is a fold placeholder ending at the max length boundary", -> + it "wraps the line after the fold placeholder", -> + renderer.createFold([[3, 47], [3, 51]]) + expect(renderer.lineForRow(3).text).toBe ' var pivot = items.shift(), current, left = ...' + expect(renderer.lineForRow(4).text).toBe 'right = [];' + describe "when the buffer changes", -> describe "when buffer lines are updated", -> describe "when the update makes a soft-wrapped line shorter than the max line length", -> @@ -397,7 +403,7 @@ fdescribe "Renderer", -> expect(event.oldRange).toEqual [[4, 0], [4, 56]] expect(event.newRange).toEqual [[4, 0], [4, 60]] - fdescribe "position translation", -> + describe "position translation", -> describe "when there is single fold spanning multiple lines", -> it "translates positions to account for folded lines and characters and the placeholder", -> renderer.createFold([[4, 29], [7, 4]]) diff --git a/spec/atom/screen-line-fragment-spec.coffee b/spec/atom/screen-line-fragment-spec.coffee index 571ac9e6a..acd1ea0a4 100644 --- a/spec/atom/screen-line-fragment-spec.coffee +++ b/spec/atom/screen-line-fragment-spec.coffee @@ -45,8 +45,12 @@ describe "screenLineFragment", -> expect(right2.outputDelta).toEqual [0, 10] describe "if splitting at 0", -> - it "returns undefined for the left half", -> - expect(screenLine.splitAt(0)).toEqual [undefined, screenLine] + it "returns an empty line fragment for the left half", -> + left = screenLine.splitAt(0)[0] + expect(left.text).toBe '' + expect(left.tokens).toEqual [] + expect(left.inputDelta).toEqual [0, 0] + expect(left.outputDelta).toEqual [0, 0] describe "if splitting at a column equal to the line length", -> it "returns an empty line fragment that spans a row for the right half", -> diff --git a/src/atom/screen-line-fragment.coffee b/src/atom/screen-line-fragment.coffee index fcd36cbd2..7ecf3c988 100644 --- a/src/atom/screen-line-fragment.coffee +++ b/src/atom/screen-line-fragment.coffee @@ -11,7 +11,7 @@ class ScreenLineFragment _.extend(this, extraFields) splitAt: (column) -> - return [undefined, this] if column == 0 + return [new ScreenLineFragment([], '', [0, 0], [0, 0]), this] if column == 0 rightTokens = _.clone(@tokens) leftTokens = []