mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Fold placeholder lines are treated as if they're empty
This commit is contained in:
@@ -395,6 +395,10 @@ describe "Renderer", ->
|
||||
expect(renderer.clipScreenPosition([0, 30], wrapBeyondNewlines: true)).toEqual [1, 0]
|
||||
expect(renderer.clipScreenPosition([0, 1000], wrapBeyondNewlines: true)).toEqual [1, 0]
|
||||
|
||||
it "wraps positions in the middle of fold lines to the next screen line", ->
|
||||
renderer.createFold(3, 5)
|
||||
expect(renderer.clipScreenPosition([3, 5], wrapBeyondNewlines: true)).toEqual [4, 0]
|
||||
|
||||
describe "when wrapAtSoftNewlines is false (the default)", ->
|
||||
it "clips positions at the end of soft-wrapped lines to the character preceding the end of the line", ->
|
||||
expect(renderer.clipScreenPosition([3, 50])).toEqual [3, 50]
|
||||
|
||||
@@ -121,8 +121,8 @@ class LineMap
|
||||
targetDelta = traversalResult[targetDeltaType]
|
||||
|
||||
return targetDelta unless lastLineFragment
|
||||
maxSourceColumn = sourceDelta.column + lastLineFragment.text.length
|
||||
maxTargetColumn = targetDelta.column + lastLineFragment.text.length
|
||||
maxSourceColumn = sourceDelta.column + lastLineFragment.textLength()
|
||||
maxTargetColumn = targetDelta.column + lastLineFragment.textLength()
|
||||
|
||||
if lastLineFragment.isSoftWrapped() and sourcePosition.column >= maxSourceColumn
|
||||
if wrapAtSoftNewlines
|
||||
|
||||
@@ -49,11 +49,7 @@ class ScreenLineFragment
|
||||
|
||||
translateColumn: (sourceDeltaType, targetDeltaType, sourceColumn, options={}) ->
|
||||
{ skipAtomicTokens } = options
|
||||
if @fold
|
||||
textLength = 0
|
||||
else
|
||||
textLength = @text.length
|
||||
sourceColumn = Math.min(sourceColumn, textLength)
|
||||
sourceColumn = Math.min(sourceColumn, @textLength())
|
||||
|
||||
currentSourceColumn = 0
|
||||
currentTargetColumn = 0
|
||||
@@ -75,6 +71,12 @@ class ScreenLineFragment
|
||||
remainingColumns = sourceColumn - currentSourceColumn
|
||||
currentTargetColumn + remainingColumns
|
||||
|
||||
textLength: ->
|
||||
if @fold
|
||||
textLength = 0
|
||||
else
|
||||
textLength = @text.length
|
||||
|
||||
isSoftWrapped: ->
|
||||
@screenDelta.row == 1 and @bufferDelta.row == 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user