Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.91 KB | None | 0 0
  1. diff --git languages/cpp/parser/commentformatter.cpp languages/cpp/parser/commentformatter.cpp
  2. index 59edf44..1ba7b5a 100644
  3. --- languages/cpp/parser/commentformatter.cpp
  4. +++ languages/cpp/parser/commentformatter.cpp
  5. @@ -49,6 +49,25 @@ QList<KDevelop::ProblemPointer> CommentFormatter::extractToDos( uint token, cons
  6.        stripped_left += KDevelop::strip( "**", *it );
  7.        stripped_right += KDevelop::rStrip( "/**", *it );
  8.  
  9. +      int left_spaces;
  10. +      for (left_spaces = 0; left_spaces < it->size(); ++left_spaces) {
  11. +        if (!isSpace((*it)[left_spaces])) {
  12. +          break;
  13. +        }
  14. +      }
  15. +
  16. +      int right_spaces;
  17. +      for (right_spaces = it->size() - 1; right_spaces >= 0; --right_spaces) {
  18. +        if (!isSpace((*it)[right_spaces])) {
  19. +          break;
  20. +        }
  21. +      }
  22. +      right_spaces = it->size() - 1 - right_spaces;
  23. +
  24. +      stripped_left += left_spaces;
  25. +      stripped_right += right_spaces;
  26. +      *it = it->mid(left_spaces, it->size() - left_spaces - right_spaces);
  27. +
  28.        if( KDevelop::containsToDos(*it) ) {
  29.          KDevelop::ProblemPointer p(new KDevelop::Problem());
  30.          p->setSource(KDevelop::ProblemData::ToDo);
  31. diff --git languages/cpp/parser/tests/test_parser.cpp languages/cpp/parser/tests/test_parser.cpp
  32. index 94748e6..5356dc4 100644
  33. --- languages/cpp/parser/tests/test_parser.cpp
  34. +++ languages/cpp/parser/tests/test_parser.cpp
  35. @@ -377,7 +377,7 @@ private slots:
  36.      QVERIFY(it);
  37.      it = it->next;
  38.      QVERIFY(it);
  39. -    QCOMPARE(CommentFormatter::formatComment(it->element->comments, lastSession), QByteArray("FIXME comment\nthis is TODO\nTODO: comment\n(another TODO)"));
  40. +    QCOMPARE(CommentFormatter::formatComment(it->element->comments, lastSession), QByteArray("FIXME comment\nthis is TODO\n TODO: comment\n(another TODO)"));
  41.      it = it->next;
  42.      QVERIFY(it);
  43.      QCOMPARE(CommentFormatter::formatComment(it->element->comments, lastSession), QByteArray("Just a simple comment"));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement