mirror of
https://github.com/atom/atom.git
synced 2026-01-22 21:38:10 -05:00
Avoid row map corruption when replacing a subset of a fold's buffer rows
Fixes #1576 When splicing regions into the row map, we always express the starting buffer row, then the number of buffer rows covered by the regions we're inserting. When we're inserting regions representing folds, they always extend to the end of a fold, so we need to ensure the endBufferRow also extends to the end of the fold. For example, say rows [5…10] are folded, and we handle a replacement of rows [5…8]. We will still insert a region for the fold covering 1 screen row and 5 buffer rows, so we need to update the endBufferRow to extend to the end of the fold as well (10).
This commit is contained in:
@@ -584,6 +584,7 @@ class DisplayBuffer extends Model
|
||||
|
||||
updateScreenLines: (startBufferRow, endBufferRow, bufferDelta=0, options={}) ->
|
||||
startBufferRow = @rowMap.bufferRowRangeForBufferRow(startBufferRow)[0]
|
||||
endBufferRow = @rowMap.bufferRowRangeForBufferRow(endBufferRow - 1)[1]
|
||||
startScreenRow = @rowMap.screenRowRangeForBufferRow(startBufferRow)[0]
|
||||
endScreenRow = @rowMap.screenRowRangeForBufferRow(endBufferRow - 1)[1]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user