Guest User

Untitled

a guest
Jan 11th, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.01 KB | None | 0 0
  1. diff --git a/src/plugins/beautifier/clangformat/clangformat.cpp b/src/plugins/beautifier/clangformat/clangformat.cpp
  2. index 79eee4a..66eb906 100644
  3. --- a/src/plugins/beautifier/clangformat/clangformat.cpp
  4. +++ b/src/plugins/beautifier/clangformat/clangformat.cpp
  5. @@ -52,6 +52,7 @@
  6.  
  7. #include <QAction>
  8. #include <QMenu>
  9. +#include <QRegularExpression>
  10.  
  11. namespace Beautifier {
  12. namespace Internal {
  13. @@ -136,9 +137,14 @@ Command ClangFormat::command(int offset, int length) const
  14. if (m_settings->usePredefinedStyle()) {
  15. command.addOption(QLatin1String("-style=") + m_settings->predefinedStyle());
  16. } else {
  17. - command.addOption(QLatin1String("-style={")
  18. - + m_settings->style(m_settings->customStyle()).remove(QLatin1Char('\n'))
  19. - + QLatin1Char('}'));
  20. + QString customStyle = m_settings->style(m_settings->customStyle());
  21. + customStyle = customStyle.replace(QRegularExpression(QString::fromLatin1("\n+")), QString::fromLatin1(","));
  22. + if(customStyle.endsWith(QString::fromLatin1(",")))
  23. + customStyle.chop(1);
  24. + if(customStyle.startsWith(QString::fromLatin1(",")))
  25. + customStyle.remove(0, 1);
  26. +
  27. + command.addOption(QLatin1String("-style={") + customStyle + QLatin1Char('}'));
  28. }
  29.  
  30. if (offset != -1) {
Add Comment
Please, Sign In to add comment