Permalink
Browse files

Use caret’s right scope when expanding tab triggers

  • Loading branch information...
sorbits committed Sep 30, 2012
1 parent fa6659d commit aef4a2206c39e85e38cca125a7d0014d382eac19
Showing with 2 additions and 1 deletion.
  1. +2 −1 Frameworks/OakTextView/src/OakTextView.mm
@@ -79,6 +79,7 @@ - (void)highlightRanges:(ng::ranges_t const&)ranges;
bool lastWasWordChar = false;
std::string lastCharacterClass = ng::kCharacterClassUnknown;
+ scope::scope_t const rightScope = ng::scope(buffer, ng::ranges_t(caret), scopeAttributes).right;
for(size_t i = bol; i < caret; i += buffer[i].size())
{
// we don’t use text::is_word_char because that function treats underscores as word characters, which is undesired, see <issue://157>.
@@ -87,7 +88,7 @@ - (void)highlightRanges:(ng::ranges_t const&)ranges;
if(i == bol || lastWasWordChar != isWordChar || lastCharacterClass != characterClass)
{
- std::vector<bundles::item_ptr> const& items = bundles::query(bundles::kFieldTabTrigger, buffer.substr(i, caret), ng::scope(buffer, ng::ranges_t(i), scopeAttributes));
+ std::vector<bundles::item_ptr> const& items = bundles::query(bundles::kFieldTabTrigger, buffer.substr(i, caret), scope::context_t(ng::scope(buffer, ng::ranges_t(i), scopeAttributes).left, rightScope));
if(!items.empty())
{
if(range)

0 comments on commit aef4a22

Please sign in to comment.