forked from qt-creator/qt-creator
ClangFormat: Fix handling more complex styles
Change-Id: I8c30c90a81bef786cdd0946351bf2cf46cc906ee Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -63,10 +63,6 @@ static void readTable(QTableWidget *table, std::istringstream &stream)
|
|||||||
if (firstLetter == std::string::npos || line.at(firstLetter) == '#')
|
if (firstLetter == std::string::npos || line.at(firstLetter) == '#')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Increase indent where it already exists.
|
|
||||||
if (firstLetter > 0 && firstLetter < 5)
|
|
||||||
line = " " + line;
|
|
||||||
|
|
||||||
table->insertRow(table->rowCount());
|
table->insertRow(table->rowCount());
|
||||||
const size_t colonPos = line.find_first_of(':');
|
const size_t colonPos = line.find_first_of(':');
|
||||||
auto *keyItem = new QTableWidgetItem;
|
auto *keyItem = new QTableWidgetItem;
|
||||||
@@ -104,8 +100,6 @@ static QByteArray tableToYAML(QTableWidget *table)
|
|||||||
auto *valueItem = table->item(i, 1);
|
auto *valueItem = table->item(i, 1);
|
||||||
|
|
||||||
QByteArray itemText = keyItem->text().toUtf8();
|
QByteArray itemText = keyItem->text().toUtf8();
|
||||||
// Change the indent back to 2 spaces
|
|
||||||
itemText.replace(" ", " ");
|
|
||||||
if (!valueItem->text().isEmpty() || !itemText.trimmed().startsWith('-'))
|
if (!valueItem->text().isEmpty() || !itemText.trimmed().startsWith('-'))
|
||||||
itemText += ": ";
|
itemText += ": ";
|
||||||
itemText += valueItem->text().toUtf8() + '\n';
|
itemText += valueItem->text().toUtf8() + '\n';
|
||||||
|
Reference in New Issue
Block a user