LineWrapper.splitTokens splits line when tokens exceed LineWrapper.maxLength

This commit is contained in:
Corey Johnson
2012-02-08 15:42:16 -08:00
parent 3742700810
commit 21e05f7218
2 changed files with 54 additions and 1 deletions

View File

@@ -34,6 +34,19 @@ class LineWrapper
for row in [start..end]
@buildWrappedLineForBufferRow(row)
splitTokens: (tokens) ->
return [] unless tokens.length
length = 0
screenLine = []
while tokens.length
break if length + tokens[0].value.length > @maxLength
token = tokens.shift()
length += token.value.length
screenLine.push token
[screenLine].concat @splitTokens(tokens)
buildWrappedLineForBufferRow: (bufferRow) ->
wordRegex = getWordRegex()
line = @buffer.getLine(bufferRow)