From b59d4befe64853c7acbd6d6dab88114adf9f20b8 Mon Sep 17 00:00:00 2001 From: eidheim Date: Tue, 6 Oct 2020 09:59:08 +0200 Subject: [PATCH] Fixed markup on ctags results --- src/ctags.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ctags.cpp b/src/ctags.cpp index ccde85e..823a3a4 100644 --- a/src/ctags.cpp +++ b/src/ctags.cpp @@ -138,6 +138,7 @@ Ctags::Location Ctags::get_location(const std::string &line_, bool add_markup, b if(add_markup) { location.source = Glib::Markup::escape_text(location.source); std::string symbol = Glib::Markup::escape_text(location.symbol); + auto symbol_size = symbol.size(); if(symbol_ends_with_open_parenthesis) symbol += '('; bool first = true; @@ -145,9 +146,9 @@ Ctags::Location Ctags::get_location(const std::string &line_, bool add_markup, b for(size_t i = 0; i < location.source.size(); i++) { if(!escaped) { if(starts_with(location.source, i, symbol)) { - location.source.insert(i + symbol.size(), ""); + location.source.insert(i + symbol_size, ""); location.source.insert(i, ""); - i += 7 + symbol.size() - 1; + i += 7 + symbol_size - 1; first = false; } else {