Abdelrazak Younes wrote:
Marco Bravi wrote:
Suggestion:
I think the new behaviour (automatic selection of the matching records)
is perfectly ok. However, all the records matching the typed string in
any part of it (authors, title, journal... just if it were a single
string) should be matched.
If the record info is divided into multiple internal memory fields
(which I think it is), an idea could be to just have LyX search all of
these fields.
That would be quite easy to implement I guess. But I am worried about
performance because this is "search as you type". Could you please
check if performance is OK with this patch?
The attached patch performs *much* better. I've loaded all bibtex files
of the Miktex distribution and it works fine.
Objection?
Abdel.
Index: QCitation.C
===================================================================
--- QCitation.C (revision 17455)
+++ QCitation.C (working copy)
@@ -113,8 +113,21 @@
void QCitation::findKey(QString const & str)
{
- QStringList sl = available_keys_.stringList().filter(str,
Qt::CaseInsensitive);
- found_keys_.setStringList(sl);
+ QStringList keys = (str.size() > 1)?
+ found_keys_.stringList() : available_keys_.stringList();
+ QStringList result;
+
+ // First search within the key info:
+ for (int i = 0; i < keys.size(); ++i) {
+ QString info = getKeyInfo(keys[i]);
+ if (info.contains(str, Qt::CaseInsensitive))
+ result += keys[i];
+ }
+
+ // Then add also the matching keys:
+ result += keys.filter(str, Qt::CaseInsensitive);
+
+ found_keys_.setStringList(result);
}