mirror of
https://github.com/atom/atom.git
synced 2026-01-25 06:48:28 -05:00
Renderer can place a fold placeholder directly before a soft-wrap
This commit is contained in:
@@ -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]])
|
||||
|
||||
@@ -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", ->
|
||||
|
||||
@@ -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 = []
|
||||
|
||||
Reference in New Issue
Block a user