Fix incorrect source line info in the CLI console

fixes #8240
This commit is contained in:
Gunnar Beutner 2015-01-16 10:07:11 +01:00
parent 76fefaf9e2
commit 4e96d48e87
1 changed files with 7 additions and 3 deletions

View File

@ -109,9 +109,13 @@ int ConsoleCommand::Run(const po::variables_map& vm, const std::vector<std::stri
} catch (const ScriptError& ex) {
DebugInfo di = ex.GetDebugInfo();
std::cout << di.Path << ": " << lines[di.Path] << "\n";
std::cout << String(di.Path.GetLength() + 2, ' ');
std::cout << String(di.FirstColumn, ' ') << String(di.LastColumn - di.FirstColumn + 1, '^') << "\n";
if (lines.find(di.Path) != lines.end()) {
std::cout << di.Path << ": " << lines[di.Path] << "\n";
std::cout << String(di.Path.GetLength() + 2, ' ');
std::cout << String(di.FirstColumn, ' ') << String(di.LastColumn - di.FirstColumn + 1, '^') << "\n";
} else {
ShowCodeFragment(std::cout, di);
}
std::cout << ex.what() << "\n";
} catch (const std::exception& ex) {