Bug 88759 - Multiple formulas in one paragraph confuse Kopete
Summary: Multiple formulas in one paragraph confuse Kopete
Status: RESOLVED FIXED
Alias: None
Product: kopete
Classification: Applications
Component: Latex Plugin (show other bugs)
Version: 0.9.0
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Kopete Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-03 12:01 UTC by Ingo Klöcker
Modified: 2004-09-04 00:59 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
the proposed fix (1.38 KB, patch)
2004-09-03 15:09 UTC, Ingo Klöcker
Details

Note You need to log in before you can comment on or make changes to this bug.
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.