Initial attempt

This commit is contained in:
Antonio Scandurra
2015-02-14 19:04:53 +01:00
parent 2dac7fd18e
commit 7f1bb69580
3 changed files with 16 additions and 4 deletions

View File

@@ -841,7 +841,7 @@ class DisplayBuffer extends Model
if screenLine.isSoftWrapped() and column >= maxScreenColumn
if wrapAtSoftNewlines
row++
column = 0
column = @screenLines[row].tokens[0].value.length # TODO: call screenLine.clipScreenColumn
else
column = screenLine.clipScreenColumn(maxScreenColumn - 1)
else if wrapBeyondNewlines and column > maxScreenColumn and row < @getLastRow()

View File

@@ -144,6 +144,14 @@ class Token
isHardTab: isHardTab
)
buildPhantomToken: (length) ->
new Token(
value: _.multiplyString(" ", length),
scopes: @scopes,
bufferDelta: 0,
isAtomic: true
)
isOnlyWhitespace: ->
not WhitespaceRegex.test(@value)

View File

@@ -97,19 +97,23 @@ class TokenizedLine
leftTextLength += nextToken.value.length
leftTokens.push nextToken
tab = leftTokens[0].buildPhantomToken(@indentLevel * 2)
leftFragment = new TokenizedLine(
tokens: leftTokens
startBufferColumn: @startBufferColumn
ruleStack: @ruleStack
invisibles: @invisibles
lineEnding: null
lineEnding: null,
indentLevel: @indentLevel
)
rightFragment = new TokenizedLine(
tokens: rightTokens
tokens: [tab].concat(rightTokens)
startBufferColumn: @bufferColumnForScreenColumn(column)
ruleStack: @ruleStack
invisibles: @invisibles
lineEnding: @lineEnding
lineEnding: @lineEnding,
indentLevel: @indentLevel
)
[leftFragment, rightFragment]