mirror of
https://github.com/atom/atom.git
synced 2026-01-29 16:58:20 -05:00
Do not rely on text anymore, check phantom tokens instead
This commit is contained in:
@@ -867,7 +867,7 @@ class DisplayBuffer extends Model
|
||||
|
||||
if /\s/.test(line.text[softWrapColumn])
|
||||
# search forward for the start of a word past the boundary
|
||||
for column in [softWrapColumn..line.text.length] when line.isOutsidePhantomToken(column)
|
||||
for column in [softWrapColumn..line.text.length]
|
||||
return column if /\S/.test(line.text[column])
|
||||
|
||||
return line.text.length
|
||||
@@ -1164,7 +1164,7 @@ class DisplayBuffer extends Model
|
||||
softWraps = 0
|
||||
while wrapScreenColumn = @findWrapColumn(tokenizedLine)
|
||||
[wrappedLine, tokenizedLine] = tokenizedLine.softWrapAt(wrapScreenColumn)
|
||||
break if wrappedLine.text == tokenizedLine.text
|
||||
break if wrappedLine.hasOnlyPhantomTokens()
|
||||
screenLines.push(wrappedLine)
|
||||
softWraps++
|
||||
screenLines.push(tokenizedLine)
|
||||
|
||||
@@ -130,6 +130,9 @@ class TokenizedLine
|
||||
isInsidePhantomToken: (column) ->
|
||||
@tokens[0].isPhantom && column < @tokens[0].screenDelta
|
||||
|
||||
hasOnlyPhantomTokens: ->
|
||||
@tokens.length == 1 && @tokens[0].isPhantom
|
||||
|
||||
tokenAtBufferColumn: (bufferColumn) ->
|
||||
@tokens[@tokenIndexAtBufferColumn(bufferColumn)]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user