Bug 88759

Summary: Multiple formulas in one paragraph confuse Kopete
Product: [Applications] kopete Reporter: Ingo Klöcker <kloecker>
Component: Latex PluginAssignee: Kopete Developers <kopete-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 0.9.0   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: the proposed fix

Description Ingo Klöcker 2004-09-03 12:01:36 UTC
Version:           0.9.0 (using KDE 3.3.0, compiled sources)
Compiler:          gcc version 3.3.1 (SuSE Linux)
OS:                Linux (i686) release 2.4.21-243-default

If one sends

  Two formulas: $$1+1=2$$ and $$a^2+b^2=c^2$$.

then the LaTeX plugin will interpret "$$ and $$" as formula and ignore the rest. So one gets:

  Two formulas: $$1+1=2 [and] a^2+b^2=c^2$$.

where [and] is "and" rendered as formula.

Looking at the source, apparently using
  QRegExp rg("\\$\\$.+\\$\\$");
  rg.setMinimal(true);
doesn't work. Maybe it's even a bug in Qt (I'm using Qt 3.3.2) because it seems to ignore the first "$$".
Comment 1 Ingo Klöcker 2004-09-03 15:08:22 UTC
No, it was a bug in the LaTeX plugin. The attached patch fixes the problem and also fixes the infinite loop Olivier worked around by adding a loop count. The fix is basically

-               rg.search(messageText, pos);
+               pos = rg.search(messageText, pos);

The rest just removes some code which is obsolete, i.e. the count<30 workaround and the nonsensical if ( !match.length() ) because match will never have zero length if pos >= 0.
Comment 2 Ingo Klöcker 2004-09-03 15:09:25 UTC
Created attachment 7401 [details]
the proposed fix
Comment 3 Olivier Goffart 2004-09-03 16:22:52 UTC
I tested your patch, and seems to work verry fine.
Thank you.

If you have a CVS account, feel free to commit.
If not, I can do it.
Comment 4 Ingo Klöcker 2004-09-04 00:59:03 UTC
I've committed the fix to the 3.3 branch and to HEAD.