Bug 130148 - Completion of citations broken if numbers/dots used
Summary: Completion of citations broken if numbers/dots used
Status: RESOLVED FIXED
Alias: None
Product: kile
Classification: Applications
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Jeroen Wijnhout
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-02 14:48 UTC by Dominic Battre
Modified: 2006-09-03 15:25 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Fixes the completion of bibtex citations with numbers and dots (933 bytes, patch)
2006-07-02 14:50 UTC, Dominic Battre
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dominic Battre 2006-07-02 14:48:28 UTC
Version:           1.9.1 (using KDE KDE 3.5.3)
Installed from:    Gentoo Packages

If your bibtex labels contain numbers and dots, the completion of citations is broken.

e.g. type \cite{<ENTER>db.p2p.h<ENTER> for db.p2p.heine.2006.infoscale I get the following debug output:

kile: ==CodeCompletion::completeWord()=========
kile: ==CodeCompletion::completeWord(d)=========
kile: ==CodeCompletion::completeWord(db)=========
kile: ==CodeCompletion::completeWord(p)=========
kile: ==CodeCompletion::completeWord(p2)=========
kile: ==CodeCompletion::completeWord(p2p)=========
kile: ==CodeCompletion::completeWord(h)=========

and the editor creates this reference:

\cite{db.p2p.hb.p2p.heine.2006.infoscale}

The attached patch fixes the problem.
Comment 1 Dominic Battre 2006-07-02 14:50:07 UTC
Created attachment 16855 [details]
Fixes the completion of bibtex citations with numbers and dots
Comment 2 Dominic Battre 2006-07-02 22:56:41 UTC
I just realized that _ is another perferctly legal and common character.  It should be easy to adapt the patch.  But make sure not to use isPuctuation, because that breaks \cite{foo,bar}.
Comment 3 Jeroen Wijnhout 2006-07-03 20:41:48 UTC
Thanks for the patch. I've tested it and it indeed fixes the bug (of which I was unaware)! After some more testing I will commit it.

best,
Jeroen
Comment 4 Thomas Braun 2006-09-03 15:25:59 UTC
SVN commit 580408 by tbraun:

BUG: 130148

patch already commited to the 1.9 branch,
patch by Dominic Battre


 M  +2 -2      codecompletion.cpp  


--- trunk/extragear/office/kile/kile/codecompletion.cpp #580407:580408
@@ -45,7 +45,7 @@
 	static QRegExp::QRegExp reRefExt;
 	static QRegExp::QRegExp reCite;
 	static QRegExp::QRegExp reCiteExt;
-	static QRegExp::QRegExp reNotRefChars("[^a-zA-z0-9_@\\+\\-\\*\\:]");
+	static QRegExp::QRegExp reNotRefChars("[^a-zA-z0-9_@\\.\\+\\-\\*\\:]");
 	
 	CodeCompletion::CodeCompletion(KileInfo *info) : m_ki(info), m_view(0L)
 	{
@@ -1096,7 +1096,7 @@
 			// get current character
 			ch = textline.at( index );
 
-			if ( ch.isLetter() || ( latexmode && ( index + 1 == ( int ) col ) && ch == '{' ) )
+			if ( ch.isLetter() || ch=='.' || ch == '_' || ch.isDigit() || ( latexmode && ( index + 1 == ( int ) col ) && ch == '{' ) )
 				++n;                           // accept letters and '{' as first character in latexmode
 			else
 			{