From df7ea719f0371b7fd8239e967f572b0de8ebf752 Mon Sep 17 00:00:00 2001 From: eidheim Date: Mon, 4 Jul 2016 17:36:15 +0200 Subject: [PATCH] Ctags fix for MSYS2 --- src/ctags.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ctags.cc b/src/ctags.cc index 1dd1f25..ce09cc8 100644 --- a/src/ctags.cc +++ b/src/ctags.cc @@ -44,10 +44,18 @@ std::pair > Ctags::g Ctags::Location Ctags::get_location(const std::string &line, bool markup) { Location location; - + +#ifdef _WIN32 + auto line_fixed=line; + if(!line_fixed.empty() && line_fixed.back()=='\r') + line_fixed.pop_back(); +#else + auto &line_fixed=line; +#endif + const static std::regex regex("^([^\t]+)\t([^\t]+)\t(?:/\\^)?([ \t]*)(.+)$"); std::smatch sm; - if(std::regex_match(line, sm, regex)) { + if(std::regex_match(line_fixed, sm, regex)) { location.source=sm[4].str(); size_t pos=location.source.find(";\"\tline:"); if(pos==std::string::npos)