From 0ba5dc8d5858040005b46e2816dfb9811fef84af Mon Sep 17 00:00:00 2001 From: Olivier Goffart <olivier.goffart@nokia.com> Date: Mon, 26 Jul 2010 13:03:44 +0200 Subject: [PATCH] QmlJsDelta: Fix the fact that sometimes, when inserting items, the new item could match the next item --- src/libs/qmljs/qmljsdelta.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/libs/qmljs/qmljsdelta.cpp b/src/libs/qmljs/qmljsdelta.cpp index f7b115aa48a..57d0db09a1d 100644 --- a/src/libs/qmljs/qmljsdelta.cpp +++ b/src/libs/qmljs/qmljsdelta.cpp @@ -185,12 +185,20 @@ Map MatchFragment(UiObjectMember *x, UiObjectMember *y, const Map &M, Document:: QList<UiObjectMember *> list2 = children(y); for (int i = 0; i < list1.count(); i++) { QString l = label(list1[i], doc1); + int foundJ = -1; + Map M3; for (int j = 0; j < list2.count(); j++) { if (l != label(list2[j], doc2)) continue; - M2 += MatchFragment(list1[i], list2[j], M, doc1, doc2); - list2.removeAt(j); - break; + Map M4 = MatchFragment(list1[i], list2[j], M, doc1, doc2); + if (M4.count() > M3.count()) { + M3 = M4; + foundJ = j; + } + } + if (foundJ != -1) { + list2.removeAt(foundJ); + M2 += M3; } } return M2; -- GitLab