From eb4944b07d4b2a43f71cb82a28a775a81a9524dd Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 10 Aug 2015 14:21:23 -0600 Subject: [PATCH] Make bufferRangeForScopeAtPosition work with last column of scope --- spec/tokenized-buffer-spec.coffee | 1 + src/tokenized-buffer.coffee | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/tokenized-buffer-spec.coffee b/spec/tokenized-buffer-spec.coffee index 2a4f23de6..4945b37ec 100644 --- a/spec/tokenized-buffer-spec.coffee +++ b/spec/tokenized-buffer-spec.coffee @@ -585,6 +585,7 @@ describe "TokenizedBuffer", -> describe "when the selector matches a single token at the position", -> 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, 3])).toEqual [[0, 0], [0, 3]] 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)", -> diff --git a/src/tokenized-buffer.coffee b/src/tokenized-buffer.coffee index b4b381c63..473e74cf5 100644 --- a/src/tokenized-buffer.coffee +++ b/src/tokenized-buffer.coffee @@ -490,7 +490,7 @@ class TokenizedBuffer extends Model scopes.pop() else endColumn = startColumn + tag - if endColumn > position.column + if endColumn >= position.column break else startColumn = endColumn