Handle zero-width and double-width characters in string literals and comments.
Summary:
Count column width instead of the number of code points. This also
includes correct handling of tabs inside string literals and comments (with an
exception of multiline string literals/comments, where tabs are present before
the first escaped newline).
Reviewers: djasper, klimek
Reviewed By: klimek
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D1601
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190052 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/WhitespaceManager.cpp b/lib/Format/WhitespaceManager.cpp
index 41519b6..0f46e62 100644
--- a/lib/Format/WhitespaceManager.cpp
+++ b/lib/Format/WhitespaceManager.cpp
@@ -272,8 +272,8 @@
if (!Style.UseTab)
return std::string(Spaces, ' ');
- return std::string(Spaces / Style.IndentWidth, '\t') +
- std::string(Spaces % Style.IndentWidth, ' ');
+ return std::string(Spaces / Style.TabWidth, '\t') +
+ std::string(Spaces % Style.TabWidth, ' ');
}
} // namespace format