forked from qt-creator/qt-creator
GenericProject: fix sorting file list when appending an entry
pos was -1 for a value that should have been appended as
last element to the list. Unfortunately, list->insert
treats -1 as prepending in front of the list, which lead
to incorrectly sorted lists.
The function got broken during the review process of
the introducing commit 758544c058
.
Change-Id: I693e4d79b0d493deeac0ea8781d637fe50d008b8
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
committed by
André Hartmann
parent
36b654567d
commit
c29e483607
@@ -239,6 +239,9 @@ bool GenericProject::saveRawList(const QStringList &rawList, const QString &file
|
||||
static void insertSorted(QStringList *list, const QString &value)
|
||||
{
|
||||
int pos = Utils::indexOf(*list, [value](const QString &s) { return s > value; });
|
||||
if (pos == -1)
|
||||
list->append(value);
|
||||
else
|
||||
list->insert(pos, value);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user