forked from qt-creator/qt-creator
TextEditor: Indent line when comment marker is not in the first column
Change-Id: I02713f1151264411451c5d9b476847e451ccef05 Fixes: QTCREATORBUG-21852 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
@@ -2011,19 +2011,22 @@ void TextEditorWidgetPrivate::moveLineUpDown(bool up)
|
||||
|
||||
bool shouldReindent = true;
|
||||
if (m_commentDefinition.isValid()) {
|
||||
QString trimmedText(text.trimmed());
|
||||
|
||||
if (m_commentDefinition.hasSingleLineStyle()) {
|
||||
if (trimmedText.startsWith(m_commentDefinition.singleLine))
|
||||
shouldReindent = false;
|
||||
}
|
||||
if (shouldReindent && m_commentDefinition.hasMultiLineStyle()) {
|
||||
if (m_commentDefinition.hasMultiLineStyle()) {
|
||||
// Don't have any single line comments; try multi line.
|
||||
if (trimmedText.startsWith(m_commentDefinition.multiLineStart)
|
||||
&& trimmedText.endsWith(m_commentDefinition.multiLineEnd)) {
|
||||
if (text.startsWith(m_commentDefinition.multiLineStart)
|
||||
&& text.endsWith(m_commentDefinition.multiLineEnd)) {
|
||||
shouldReindent = false;
|
||||
}
|
||||
}
|
||||
if (shouldReindent && m_commentDefinition.hasSingleLineStyle()) {
|
||||
shouldReindent = false;
|
||||
QTextBlock block = move.block();
|
||||
while (block.isValid() && block.position() < end) {
|
||||
if (!block.text().startsWith(m_commentDefinition.singleLine))
|
||||
shouldReindent = true;
|
||||
block = block.next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldReindent) {
|
||||
|
||||
Reference in New Issue
Block a user