Merge pull request #8308 from atom/ns-fix-buffer-range-for-scope

Make bufferRangeForScopeAtPosition work with last column of scope
This commit is contained in:
Nathan Sobo 2015-08-10 14:53:27 -06:00
commit e83b20f695
2 changed files with 2 additions and 1 deletions

View File

@ -585,6 +585,7 @@ describe "TokenizedBuffer", ->
describe "when the selector matches a single token at the position", -> describe "when the selector matches a single token at the position", ->
it "returns the range covered by the token", -> it "returns the range covered by the token", ->
expect(tokenizedBuffer.bufferRangeForScopeAtPosition('.storage.modifier.js', [0, 1])).toEqual [[0, 0], [0, 3]] expect(tokenizedBuffer.bufferRangeForScopeAtPosition('.storage.modifier.js', [0, 1])).toEqual [[0, 0], [0, 3]]
expect(tokenizedBuffer.bufferRangeForScopeAtPosition('.storage.modifier.js', [0, 3])).toEqual [[0, 0], [0, 3]]
describe "when the selector matches a run of multiple tokens at the position", -> describe "when the selector matches a run of multiple tokens at the position", ->
it "returns the range covered by all contigous tokens (within a single line)", -> it "returns the range covered by all contigous tokens (within a single line)", ->

View File

@ -490,7 +490,7 @@ class TokenizedBuffer extends Model
scopes.pop() scopes.pop()
else else
endColumn = startColumn + tag endColumn = startColumn + tag
if endColumn > position.column if endColumn >= position.column
break break
else else
startColumn = endColumn startColumn = endColumn