Changeset View
Changeset View
Standalone View
Standalone View
src/completion/katecompletionmodel.cpp
Show First 20 Lines • Show All 1043 Lines • ▼ Show 20 Line(s) | 1036 | foreach (const Item &item, g->filtered) { | |||
---|---|---|---|---|---|
1044 | if (commonPrefix.isNull()) { | 1044 | if (commonPrefix.isNull()) { | ||
1045 | commonPrefix = candidate; | 1045 | commonPrefix = candidate; | ||
1046 | 1046 | | |||
1047 | //Replace QString::null prefix with QString(), so we won't initialize it again | 1047 | //Replace QString::null prefix with QString(), so we won't initialize it again | ||
1048 | if (commonPrefix.isNull()) { | 1048 | if (commonPrefix.isNull()) { | ||
1049 | commonPrefix = QString(); // isEmpty() = true, isNull() = false | 1049 | commonPrefix = QString(); // isEmpty() = true, isNull() = false | ||
1050 | } | 1050 | } | ||
1051 | } else { | 1051 | } else { | ||
1052 | commonPrefix = commonPrefix.left(candidate.length()); | 1052 | commonPrefix.truncate(candidate.length()); | ||
1053 | 1053 | | |||
1054 | for (int a = 0; a < commonPrefix.length(); ++a) { | 1054 | for (int a = 0; a < commonPrefix.length(); ++a) { | ||
1055 | if (commonPrefix[a] != candidate[a]) { | 1055 | if (commonPrefix[a] != candidate[a]) { | ||
1056 | commonPrefix = commonPrefix.left(a); | 1056 | commonPrefix.truncate(a); | ||
1057 | break; | 1057 | break; | ||
1058 | } | 1058 | } | ||
1059 | } | 1059 | } | ||
1060 | } | 1060 | } | ||
1061 | } | 1061 | } | ||
1062 | } | 1062 | } | ||
1063 | 1063 | | |||
1064 | return commonPrefix; | 1064 | return commonPrefix; | ||
▲ Show 20 Lines • Show All 1368 Lines • Show Last 20 Lines |