Fix line numbers with --print-changes
This commit is contained in:
parent
e4ce7b36b0
commit
03668a9b21
@ -548,11 +548,13 @@ void ASConsole::formatFile(const string& fileName_)
|
|||||||
displayName = fileName_;
|
displayName = fileName_;
|
||||||
|
|
||||||
// format the file
|
// format the file
|
||||||
|
int currentLine = 0;
|
||||||
while (formatter.hasMoreLines())
|
while (formatter.hasMoreLines())
|
||||||
{
|
{
|
||||||
nextLine = formatter.nextLine();
|
nextLine = formatter.nextLine();
|
||||||
out << nextLine;
|
out << nextLine;
|
||||||
linesOut++;
|
linesOut++;
|
||||||
|
currentLine++;
|
||||||
if (formatter.hasMoreLines())
|
if (formatter.hasMoreLines())
|
||||||
{
|
{
|
||||||
setOutputEOL(lineEndFormat, streamIterator.getOutputEOL());
|
setOutputEOL(lineEndFormat, streamIterator.getOutputEOL());
|
||||||
@ -569,6 +571,7 @@ void ASConsole::formatFile(const string& fileName_)
|
|||||||
nextLine = formatter.nextLine();
|
nextLine = formatter.nextLine();
|
||||||
out << nextLine;
|
out << nextLine;
|
||||||
linesOut++;
|
linesOut++;
|
||||||
|
currentLine++;
|
||||||
streamIterator.saveLastInputLine();
|
streamIterator.saveLastInputLine();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -580,14 +583,14 @@ void ASConsole::formatFile(const string& fileName_)
|
|||||||
if (nextLine.find_first_not_of(" \t") != string::npos)
|
if (nextLine.find_first_not_of(" \t") != string::npos)
|
||||||
{
|
{
|
||||||
if (printChanges)
|
if (printChanges)
|
||||||
printChangedLine(displayName, nextLine, linesOut);
|
printChangedLine(displayName, nextLine, currentLine);
|
||||||
filesAreIdentical = false;
|
filesAreIdentical = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!streamIterator.compareToInputBuffer(nextLine))
|
else if (!streamIterator.compareToInputBuffer(nextLine))
|
||||||
{
|
{
|
||||||
if (printChanges)
|
if (printChanges)
|
||||||
printChangedLine(displayName, nextLine, linesOut);
|
printChangedLine(displayName, nextLine, currentLine);
|
||||||
filesAreIdentical = false;
|
filesAreIdentical = false;
|
||||||
}
|
}
|
||||||
streamIterator.checkForEmptyLine = false;
|
streamIterator.checkForEmptyLine = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user