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
llvm-svn: 190052
diff --git a/clang/lib/Format/WhitespaceManager.cpp b/clang/lib/Format/WhitespaceManager.cpp
index 41519b6..0f46e62 100644
--- a/clang/lib/Format/WhitespaceManager.cpp
+++ b/clang/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