Individual tokens no longer need an isAtomic property

This commit is contained in:
Nathan Sobo
2012-03-06 19:24:14 -07:00
parent 47ee8d599d
commit 4f1c8da132
2 changed files with 5 additions and 18 deletions

View File

@@ -192,7 +192,7 @@ class Renderer
folds.sort (a, b) -> a.compare(b)
buildFoldPlaceholder: (fold) ->
token = {value: '...', type: 'fold-placeholder', fold, isAtomic: true}
token = { value: '...', type: 'fold-placeholder', fold }
new ScreenLineFragment([token], '...', [0, 3], fold.getRange().toDelta(), isAtomic: true)
screenLineRangeForBufferRange: (bufferRange) ->

View File

@@ -34,17 +34,10 @@ class ScreenLineFragment
[leftFragment, rightFragment]
splitTokenAt: (token, splitIndex) ->
if token.isAtomic
[@buildFillerToken(splitIndex), token]
else
{ type, value } = token
value1 = value.substring(0, splitIndex)
value2 = value.substring(splitIndex)
[{value: value1, type }, {value: value2, type}]
buildFillerToken: (length) ->
text = (' ' for i in [0...length]).join('')
{ value: text, type: 'text' }
{ type, value } = token
value1 = value.substring(0, splitIndex)
value2 = value.substring(splitIndex)
[{value: value1, type }, {value: value2, type}]
concat: (other) ->
tokens = @tokens.concat(other.tokens)
@@ -53,12 +46,6 @@ class ScreenLineFragment
bufferDelta = @bufferDelta.add(other.bufferDelta)
new ScreenLineFragment(tokens, text, screenDelta, bufferDelta)
lengthForClipping: ->
if @isAtomic
0
else
@text.length
isSoftWrapped: ->
@screenDelta.row == 1 and @bufferDelta.row == 0