Skip to content

Commit

Permalink
Use caret’s right scope when expanding tab triggers
Browse files Browse the repository at this point in the history
  • Loading branch information
sorbits committed Sep 30, 2012
1 parent fa6659d commit aef4a22
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Frameworks/OakTextView/src/OakTextView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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>.
Expand All @@ -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)
Expand Down

0 comments on commit aef4a22

Please sign in to comment.