* fix longest prefix algorithm for sorted models: commonPrefix(...) returns the length, not the prefix.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23217 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Stefan Schimanski 2008-02-25 02:09:39 +00:00
parent 9a5aba0877
commit ff2e0db6c2

View File

@ -695,11 +695,12 @@ docstring GuiCompleter::longestUniqueCompletion() const
QString const & mids
= model.data(model.index(mid, 0),
Qt::EditRole).toString();
int sn = s.length();
s = commonPrefix(mids, s);
size_t oldLen = s.length();
size_t len = commonPrefix(mids, s);
s = s.left(len);
// left or right?
if (s.length() == sn) {
if (oldLen == len) {
// middle is not far enough
i = mid + 1;
} else {