mirror of
https://github.com/atom/atom.git
synced 2026-02-09 06:05:11 -05:00
Add Renderer.clipScreenPosition
This commit is contained in:
@@ -66,7 +66,10 @@ class LineMap
|
||||
new Range(start, end)
|
||||
|
||||
clipOutputPosition: (outputPosition, options) ->
|
||||
@translatePosition('outputDelta', 'outputDelta', outputPosition, options)
|
||||
@clipPosition('outputDelta', outputPosition, options)
|
||||
|
||||
clipPosition: (deltaType, position, options) ->
|
||||
@translatePosition(deltaType, deltaType, position, options)
|
||||
|
||||
spliceByDelta: (deltaType, startRow, rowCount, lineFragments) ->
|
||||
stopRow = startRow + rowCount
|
||||
@@ -119,6 +122,7 @@ class LineMap
|
||||
targetDelta.column = 0
|
||||
else
|
||||
targetDelta.column = maxTargetColumn - 1
|
||||
return @clipPosition(targetDeltaType, targetDelta)
|
||||
else if sourcePosition.column > maxSourceColumn and wrapBeyondNewlines
|
||||
targetDelta.row++
|
||||
targetDelta.column = 0
|
||||
|
||||
@@ -90,6 +90,9 @@ class Renderer
|
||||
bufferPositionForScreenPosition: (position) ->
|
||||
@lineMap.inputPositionForOutputPosition(position)
|
||||
|
||||
clipScreenPosition: (position, options={}) ->
|
||||
@lineMap.clipOutputPosition(position, options)
|
||||
|
||||
handleBufferChange: (e) ->
|
||||
for row, folds of @activeFolds
|
||||
for fold in folds
|
||||
@@ -133,7 +136,7 @@ class Renderer
|
||||
suffix = buildLinesForBufferRows(fold.end.row, endRow, fold.end.column, currentScreenLineLength)
|
||||
return _.compact _.flatten [prefix, placeholder, suffix]
|
||||
|
||||
if wrapColumn
|
||||
if wrapColumn?
|
||||
line = line.splitAt(wrapColumn)[0]
|
||||
line.outputDelta = new Point(1, 0)
|
||||
[line].concat buildLinesForBufferRows(startRow, endRow, startColumn + wrapColumn)
|
||||
|
||||
Reference in New Issue
Block a user