mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Merge pull request #8334 from atom/ns-fix-wrap-scopes
Process closing scopes at wrap boundaries
This commit is contained in:
@@ -112,6 +112,13 @@ describe "DisplayBuffer", ->
|
||||
expect(displayBuffer.tokenizedLineForScreenRow(2).text).toBe 'uvwxyz'
|
||||
expect(displayBuffer.tokenizedLineForScreenRow(2).bufferDelta).toBe 'uvwxyz'.length
|
||||
|
||||
it "closes all scopes at the wrap boundary", ->
|
||||
displayBuffer.setEditorWidthInChars(10)
|
||||
buffer.setText("`aaa${1+2}aaa`")
|
||||
iterator = displayBuffer.tokenizedLineForScreenRow(1).getTokenIterator()
|
||||
scopes = iterator.getScopes()
|
||||
expect(scopes[scopes.length - 1]).not.toBe 'punctuation.section.embedded.js'
|
||||
|
||||
describe "when there is a whitespace character at the max length boundary", ->
|
||||
it "wraps the line at the first non-whitespace character following the boundary", ->
|
||||
expect(displayBuffer.tokenizedLineForScreenRow(3).text).toBe ' var pivot = items.shift(), current, left = [], '
|
||||
|
||||
@@ -387,15 +387,17 @@ class TokenizedLine
|
||||
rightSpecialTokens[rightTags.length] = specialToken
|
||||
rightTags.push(tag)
|
||||
|
||||
# tag represents the start or end of a scop
|
||||
# tag represents the start of a scope
|
||||
else if (tag % 2) is -1
|
||||
if screenColumn < column
|
||||
leftTags.push(tag)
|
||||
rightOpenScopes.push(tag)
|
||||
else
|
||||
rightTags.push(tag)
|
||||
|
||||
# tag represents the end of a scope
|
||||
else
|
||||
if screenColumn < column
|
||||
if screenColumn <= column
|
||||
leftTags.push(tag)
|
||||
rightOpenScopes.pop()
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user