handle changes that cause line to wrap once

This commit is contained in:
Corey Johnson
2012-02-08 14:05:28 -08:00
parent 1f6ab6f2b6
commit 3742700810
2 changed files with 13 additions and 2 deletions

View File

@@ -11,9 +11,17 @@ class LineWrapper
@buffer = @highlighter.buffer
@buildWrappedLines()
@highlighter.on 'change', (e) =>
oldCount = @wrappedLines[e.oldRange.start.row].screenLines.length
@wrappedLines[e.oldRange.start.row] = @buildWrappedLineForBufferRow(e.newRange.start.row)
newCount = @wrappedLines[e.oldRange.start.row].screenLines.length
oldRange = @screenRangeFromBufferRange(e.oldRange)
newRange = @screenRangeFromBufferRange(e.newRange)
if newCount > oldCount
newRange.end.row += newCount - oldCount
newRange.end.column = @tokensForScreenRow(newRange.end.row).textLength
@trigger 'change', { oldRange, newRange }
setMaxLength: (@maxLength) ->