Don't throw errors when applying screen deltas after the last mapping

This commit is contained in:
Nathan Sobo
2013-05-08 14:34:18 -06:00
parent c17d6ba487
commit 1b21fdda3b
2 changed files with 5 additions and 1 deletions

View File

@@ -179,3 +179,7 @@ describe "RowMap", ->
expect(map.screenRowRangeForBufferRow(19)).toEqual [6, 6]
expect(map.screenRowRangeForBufferRow(22)).toEqual [8, 9]
expect(map.screenRowRangeForBufferRow(26)).toEqual [8, 9]
it "does not throw an exception when applying a delta beyond the last mapping", ->
map.mapBufferRowRange(5, 10, 1) # inner fold 1
map.applyScreenDelta(15, 10)

View File

@@ -52,7 +52,7 @@ class RowMap
applyScreenDelta: (startScreenRow, delta) ->
{ index } = @traverseToScreenRow(startScreenRow)
until delta == 0
while delta != 0 and index < @mappings.length
{ bufferRows, screenRows } = @mappings[index]
screenRows += delta
if screenRows < 0