mirror of
https://github.com/atom/atom.git
synced 2026-02-19 02:44:29 -05:00
Adjust multiple mappings if needed when applying screen deltas
If there are multiple mappings following the start row of the delta that span fewer screen rows than the delta, we collapse mappings to 0 screen rows until we have removed the number of rows specified by the delta. Expanding positive deltas expands the first mapping following the start row as it did previously.
This commit is contained in:
@@ -50,9 +50,18 @@ class RowMap
|
||||
{ mapping } = @traverseToBufferRow(startBufferRow)
|
||||
mapping?.bufferRows += delta
|
||||
|
||||
applyScreenDelta: (startBufferRow, delta) ->
|
||||
{ mapping } = @traverseToScreenRow(startBufferRow)
|
||||
mapping?.screenRows += delta
|
||||
applyScreenDelta: (startScreenRow, delta) ->
|
||||
{ index } = @traverseToScreenRow(startScreenRow)
|
||||
until delta == 0
|
||||
{ bufferRows, screenRows } = @mappings[index]
|
||||
screenRows += delta
|
||||
if screenRows < 0
|
||||
delta = screenRows
|
||||
screenRows = 0
|
||||
else
|
||||
delta = 0
|
||||
@mappings[index] = { bufferRows, screenRows }
|
||||
index++
|
||||
|
||||
traverseToBufferRow: (targetBufferRow) ->
|
||||
bufferRow = 0
|
||||
|
||||
Reference in New Issue
Block a user