console: Don't repeat line when we're reporting an error for the last line

fixes #8099
This commit is contained in:
Gunnar Beutner 2015-02-09 15:15:26 +01:00
parent 9dd0fba02f
commit 438e6dcd09
1 changed files with 9 additions and 2 deletions

View File

@ -110,8 +110,15 @@ int ConsoleCommand::Run(const po::variables_map& vm, const std::vector<std::stri
DebugInfo di = ex.GetDebugInfo(); DebugInfo di = ex.GetDebugInfo();
if (lines.find(di.Path) != lines.end()) { if (lines.find(di.Path) != lines.end()) {
std::cout << di.Path << ": " << lines[di.Path] << "\n"; int offset;
std::cout << String(di.Path.GetLength() + 2, ' ');
if (di.Path != fileName) {
std::cout << di.Path << ": " << lines[di.Path] << "\n";
offset = 2;
} else
offset = 4;
std::cout << String(di.Path.GetLength() + offset, ' ');
std::cout << String(di.FirstColumn, ' ') << String(di.LastColumn - di.FirstColumn + 1, '^') << "\n"; std::cout << String(di.FirstColumn, ' ') << String(di.LastColumn - di.FirstColumn + 1, '^') << "\n";
} else { } else {
ShowCodeFragment(std::cout, di); ShowCodeFragment(std::cout, di);