mirror of
https://github.com/atom/atom.git
synced 2026-02-17 01:51:54 -05:00
Apply 'folded' decoration only to 1st screen row of a wrapped buffer row
This commit is contained in:
@@ -1127,9 +1127,9 @@ class TextEditorPresenter
|
||||
@customGutterDecorationsByGutterName = {}
|
||||
|
||||
for decorationId, decorationState of @decorations
|
||||
{properties, screenRange, rangeIsReversed} = decorationState
|
||||
{properties, bufferRange, screenRange, rangeIsReversed} = decorationState
|
||||
if Decoration.isType(properties, 'line') or Decoration.isType(properties, 'line-number')
|
||||
@addToLineDecorationCaches(decorationId, properties, screenRange, rangeIsReversed)
|
||||
@addToLineDecorationCaches(decorationId, properties, bufferRange, screenRange, rangeIsReversed)
|
||||
|
||||
else if Decoration.isType(properties, 'gutter') and properties.gutterName?
|
||||
@customGutterDecorationsByGutterName[properties.gutterName] ?= {}
|
||||
@@ -1150,7 +1150,7 @@ class TextEditorPresenter
|
||||
|
||||
return
|
||||
|
||||
addToLineDecorationCaches: (decorationId, properties, screenRange, rangeIsReversed) ->
|
||||
addToLineDecorationCaches: (decorationId, properties, bufferRange, screenRange, rangeIsReversed) ->
|
||||
if screenRange.isEmpty()
|
||||
return if properties.onlyNonEmpty
|
||||
else
|
||||
@@ -1158,21 +1158,28 @@ class TextEditorPresenter
|
||||
omitLastRow = screenRange.end.column is 0
|
||||
|
||||
if rangeIsReversed
|
||||
headPosition = screenRange.start
|
||||
headScreenPosition = screenRange.start
|
||||
headBufferPosition = bufferRange.start
|
||||
else
|
||||
headPosition = screenRange.end
|
||||
headScreenPosition = screenRange.end
|
||||
headBufferPosition = bufferRange.end
|
||||
|
||||
for row in [screenRange.start.row..screenRange.end.row] by 1
|
||||
continue if properties.onlyHead and row isnt headPosition.row
|
||||
continue if omitLastRow and row is screenRange.end.row
|
||||
if properties.class is 'folded' and Decoration.isType(properties, 'line-number')
|
||||
screenRow = @model.screenRowForBufferRow(headBufferPosition.row)
|
||||
@lineNumberDecorationsByScreenRow[screenRow] ?= {}
|
||||
@lineNumberDecorationsByScreenRow[screenRow][decorationId] = properties
|
||||
else
|
||||
for row in [screenRange.start.row..screenRange.end.row] by 1
|
||||
continue if properties.onlyHead and row isnt headScreenPosition.row
|
||||
continue if omitLastRow and row is screenRange.end.row
|
||||
|
||||
if Decoration.isType(properties, 'line')
|
||||
@lineDecorationsByScreenRow[row] ?= {}
|
||||
@lineDecorationsByScreenRow[row][decorationId] = properties
|
||||
if Decoration.isType(properties, 'line')
|
||||
@lineDecorationsByScreenRow[row] ?= {}
|
||||
@lineDecorationsByScreenRow[row][decorationId] = properties
|
||||
|
||||
if Decoration.isType(properties, 'line-number')
|
||||
@lineNumberDecorationsByScreenRow[row] ?= {}
|
||||
@lineNumberDecorationsByScreenRow[row][decorationId] = properties
|
||||
if Decoration.isType(properties, 'line-number')
|
||||
@lineNumberDecorationsByScreenRow[row] ?= {}
|
||||
@lineNumberDecorationsByScreenRow[row][decorationId] = properties
|
||||
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user