diff options
author | Francois Ferrand <thetypz@gmail.com> | 2012-03-13 15:13:05 +0100 |
---|---|---|
committer | Leandro Melo <leandro.melo@nokia.com> | 2012-03-15 06:39:29 +0100 |
commit | cbc328e2d7a2378bed9fbf6be30e03295fe8944b (patch) | |
tree | 2b9811f61c8eb0ef84900a9d1c2efb8560150d5f /src/plugins/cpptools | |
parent | 8e94d0649628124b978e9d075cd2badb36f47524 (diff) | |
download | qt-creator-cbc328e2d7a2378bed9fbf6be30e03295fe8944b.tar.gz |
CppEditor: fix indentation of auto-completed comments.
Fix indentation of auto-completed Doxygen comments, as well as auto-
leading characters from the block, to make it work with both spaces and
tabs.
Change-Id: I6c1c1665675cc25e01983e6d39b472f1b1c9683e
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
Diffstat (limited to 'src/plugins/cpptools')
-rw-r--r-- | src/plugins/cpptools/doxygengenerator.cpp | 12 | ||||
-rw-r--r-- | src/plugins/cpptools/doxygengenerator.h | 2 |
2 files changed, 4 insertions, 10 deletions
diff --git a/src/plugins/cpptools/doxygengenerator.cpp b/src/plugins/cpptools/doxygengenerator.cpp index fe48422344..5737192bf1 100644 --- a/src/plugins/cpptools/doxygengenerator.cpp +++ b/src/plugins/cpptools/doxygengenerator.cpp @@ -56,7 +56,6 @@ DoxygenGenerator::DoxygenGenerator() , m_generateBrief(true) , m_startComment(true) , m_style(QtStyle) - , m_commentOffset(0) {} void DoxygenGenerator::setStyle(DocumentationStyle style) @@ -308,16 +307,11 @@ void DoxygenGenerator::assignCommentOffset(QTextCursor cursor) cursor.setPosition(cursor.anchor()); } - m_commentOffset = cursor.positionInBlock(); + cursor.movePosition(QTextCursor::StartOfBlock, QTextCursor::KeepAnchor); + m_commentOffset = cursor.selectedText(); } QString DoxygenGenerator::offsetString() const { - // Note: Currently we don't indent comments, but simply preserve them in the original - // relative positions. What we do here is just to make sure that such positions are correct, - // although they might still be wrong from an indentation point of view (for instance, - // using spaces instead of tabs). Therefore, the content generated should still have - // the indentation strings fixed. - - return QString(m_commentOffset, QLatin1Char(' ')); + return m_commentOffset; } diff --git a/src/plugins/cpptools/doxygengenerator.h b/src/plugins/cpptools/doxygengenerator.h index a9d1cfbfa4..77b6db8504 100644 --- a/src/plugins/cpptools/doxygengenerator.h +++ b/src/plugins/cpptools/doxygengenerator.h @@ -95,7 +95,7 @@ private: bool m_startComment; DocumentationStyle m_style; CPlusPlus::Overview m_printer; - int m_commentOffset; + QString m_commentOffset; }; } // CppTools |