diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-03-31 21:40:14 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-03-31 21:40:14 +0000 |
commit | 2aa13b5cb0e055774c98cd58d1e40e3ea11481d5 (patch) | |
tree | febdcfc453d8c54fed43af132ec26701a8879757 /Driver/HTMLDiagnostics.cpp | |
parent | 69b6442f3c5524ee1014b6a9adb687b376660f60 (diff) |
When emitting HTML messages, take into account margin fusing due to tabs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48998 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/HTMLDiagnostics.cpp')
-rw-r--r-- | Driver/HTMLDiagnostics.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Driver/HTMLDiagnostics.cpp b/Driver/HTMLDiagnostics.cpp index a4736950f3..df2bb06636 100644 --- a/Driver/HTMLDiagnostics.cpp +++ b/Driver/HTMLDiagnostics.cpp @@ -200,13 +200,20 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, const char *TokLogicalPtr = LPos.getCharacterData(); const char *LineStart = TokLogicalPtr-ColNo; + // Compute the margin offset by counting tabs and non-tabs. + + unsigned PosNo = 0; + + for (const char* c = LineStart; c != TokLogicalPtr; ++c) + PosNo += *c == '\t' ? 8 : 1; + // Create the html for the message. std::ostringstream os; os << "\n<tr><td class=\"num\"></td><td class=\"line\">" << "<div class=\"msg\" style=\"margin-left:" - << ColNo << "ex\">"; + << PosNo << "ex\">"; os << html::EscapeText(P.getString()) << "</div></td></tr>"; |