please apply
thanks
john
--
"Your superior intellect is no match for our puny weapons."
Index: ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.397
diff -u -r1.397 ChangeLog
--- ChangeLog 2001/11/20 08:54:09 1.397
+++ ChangeLog 2001/11/23 08:00:49
@@ -1,3 +1,8 @@
+2001-11-23 John Levon <[EMAIL PROTECTED]>
+
+ * paragraph_pimpl.h:
+ * paragraph_pimpl.C: cleanup
+
2001-11-20 Allan Rae <[EMAIL PROTECTED]>
* paragraph.C (insertFromMinibuffer): Fix for inset related crashes.
Index: paragraph_pimpl.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph_pimpl.h,v
retrieving revision 1.3
diff -u -r1.3 paragraph_pimpl.h
--- paragraph_pimpl.h 2001/08/03 18:28:06 1.3
+++ paragraph_pimpl.h 2001/11/23 08:00:50
@@ -151,6 +151,9 @@
///
ParagraphParameters params;
private:
+ /// match a string against a particular point in the paragraph
+ bool isTextAt(string const & str, Paragraph::size_type pos);
+
/// Who owns us?
Paragraph * owner_;
///
Index: paragraph_pimpl.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph_pimpl.C,v
retrieving revision 1.17
diff -u -r1.17 paragraph_pimpl.C
--- paragraph_pimpl.C 2001/10/19 15:39:59 1.17
+++ paragraph_pimpl.C 2001/11/23 08:00:50
@@ -244,6 +244,18 @@
}
+bool Paragraph::Pimpl::isTextAt(string const & str, Paragraph::size_type pos)
+{
+ for (int i=0; i < str.length(); ++i) {
+ if (pos + i >= size())
+ return false;
+ if (str[i] != getChar(pos + i))
+ return false;
+ }
+ return true;
+}
+
+
void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf,
BufferParams const & bparams,
std::ostream & os,
@@ -441,53 +453,32 @@
break;
default:
- /* idea for labels --- begin*/
- // Check for "LyX"
- if (c == 'L'
- && i <= size() - 3
- && font.family() != LyXFont::TYPEWRITER_FAMILY
- && getChar(i + 1) == 'y'
- && getChar(i + 2) == 'X') {
+
+ // I assume this is hack treating typewriter as verbatim
+ if (font.family() == LyXFont::TYPEWRITER_FAMILY) {
+ if (c != '\0') {
+ os << c;
+ }
+ break;
+ }
+
+ if (isTextAt("LyX", i)) {
os << "\\LyX{}";
i += 2;
column += 5;
- }
- // Check for "TeX"
- else if (c == 'T'
- && i <= size() - 3
- && font.family() != LyXFont::TYPEWRITER_FAMILY
- && getChar(i + 1) == 'e'
- && getChar(i + 2) == 'X') {
+ } else if (isTextAt("TeX", i)) {
os << "\\TeX{}";
i += 2;
column += 5;
- }
- // Check for "LaTeX2e"
- else if (c == 'L'
- && i <= size() - 7
- && font.family() != LyXFont::TYPEWRITER_FAMILY
- && getChar(i + 1) == 'a'
- && getChar(i + 2) == 'T'
- && getChar(i + 3) == 'e'
- && getChar(i + 4) == 'X'
- && getChar(i + 5) == '2'
- && getChar(i + 6) == 'e') {
+ } else if (isTextAt("LaTeX2e", i)) {
os << "\\LaTeXe{}";
i += 6;
column += 8;
- }
- // Check for "LaTeX"
- else if (c == 'L'
- && i <= size() - 5
- && font.family() != LyXFont::TYPEWRITER_FAMILY
- && getChar(i + 1) == 'a'
- && getChar(i + 2) == 'T'
- && getChar(i + 3) == 'e'
- && getChar(i + 4) == 'X') {
+ } else if (isTextAt("LaTeX", i)) {
os << "\\LaTeX{}";
i += 4;
column += 7;
- /* idea for labels --- end*/
+ // do we really try to print out '\0' ?
} else if (c != '\0') {
os << c;
}
@@ -545,25 +536,22 @@
while (par && par->getDepth() && !tmpfont.resolved()) {
par = par->outerHook();
if (par) {
-#ifndef INHERIT_LANGUAGE
tmpfont.realize(textclasslist.
Style(bparams.textclass,
- par->getLayout()).font);
-#else
- tmpfont.realize(textclasslist.
- Style(bparams.textclass,
- par->getLayout()).font,
bparams.language);
+ par->getLayout()).font
+#ifdef INHERIT_LANGUAGE
+ , bparams.language
#endif
+ );
par_depth = par->getDepth();
}
}
-#ifndef INHERIT_LANGUAGE
- tmpfont.realize(textclasslist.TextClass(bparams.textclass)
- .defaultfont());
-#else
tmpfont.realize(textclasslist.TextClass(bparams.textclass)
- .defaultfont(), bparams.language);
+ .defaultfont()
+#ifdef INHERIT_LANGUAGE
+ , bparams.language
#endif
+ );
return tmpfont;
}