Browse Source

C/C++ Go to Method: slight improvement to row texts

pipelines/143601543
eidheim 6 years ago
parent
commit
469d73b8c1
  1. 12
      src/source_clang.cc

12
src/source_clang.cc

@ -1603,10 +1603,8 @@ Source::ClangViewRefactor::ClangViewRefactor(const boost::filesystem::path &file
std::string method; std::string method;
if(kind != clangmm::Cursor::Kind::Constructor && kind != clangmm::Cursor::Kind::Destructor) { if(kind != clangmm::Cursor::Kind::Constructor && kind != clangmm::Cursor::Kind::Destructor) {
method += cursor.get_type().get_result().get_spelling(); method += cursor.get_type().get_result().get_spelling();
auto pos = method.find(' '); if(!method.empty() && method.back() != '&' && method.back() != '*')
if(pos != std::string::npos) method += ' ';
method.erase(pos, 1);
method += " ";
} }
method += cursor.get_display_name(); method += cursor.get_display_name();
@ -1618,12 +1616,12 @@ Source::ClangViewRefactor::ClangViewRefactor(const boost::filesystem::path &file
} }
method = Glib::Markup::escape_text(method); method = Glib::Markup::escape_text(method);
//Add bold method token // Add bold method token
size_t token_end_pos = method.find('('); auto token_end_pos = method.find('(');
if(token_end_pos == std::string::npos) if(token_end_pos == std::string::npos)
continue; continue;
auto token_start_pos = token_end_pos; auto token_start_pos = token_end_pos;
while(token_start_pos != 0 && method[token_start_pos] != ' ') while(token_start_pos > 0 && is_token_char(method[token_start_pos - 1]))
--token_start_pos; --token_start_pos;
method.insert(token_end_pos, "</b>"); method.insert(token_end_pos, "</b>");
method.insert(token_start_pos, "<b>"); method.insert(token_start_pos, "<b>");

Loading…
Cancel
Save