--template: fixed {code} output with tabs

This commit is contained in:
Daniel Marjamäki 2018-04-23 14:11:33 +02:00
parent 74b1d1deb6
commit 84aaec26e6
1 changed files with 3 additions and 0 deletions

View File

@ -444,6 +444,9 @@ static std::string readCode(const std::string &file, unsigned int linenr, unsign
const std::string::size_type endPos = line.find_last_not_of("\r\n\t ");
if (endPos + 1 < line.size())
line.erase(endPos + 1);
std::string::size_type pos = 0;
while ((pos = line.find("\t", pos)) != std::string::npos)
line[pos] = ' ';
return line + endl + std::string((column>0 ? column-1 : column), ' ') + '^';
}