mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Don't throw errors when applying screen deltas after the last mapping
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user