From 86618e2650b6b76ca2619ee84b93b4b70e4c24d4 Mon Sep 17 00:00:00 2001 From: Stephan Witt Date: Sun, 16 Nov 2008 18:14:14 +0000 Subject: [PATCH] fix broken latex output range checking git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27571 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Paragraph.cpp | 24 +++++++++++++----------- src/Paragraph.h | 2 +- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 06290a9c7f..16fc29b9a2 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -2084,7 +2084,8 @@ bool Paragraph::latex(BufferParams const & bparams, os << fontchange; } - if (c == ' ' && i >= start_pos && i < end_pos) { + // FIXME: think about end_pos implementation... + if (c == ' ' && i >= start_pos && (end_pos == -1 || i < end_pos)) { // FIXME: integrate this case in latexSpecialChar // Do not print the separation of the optional argument // if style.pass_thru is false. This works because @@ -2113,17 +2114,18 @@ bool Paragraph::latex(BufferParams const & bparams, // Handle here those cases common to both modes // and then split to handle the two modes separately. if (c == META_INSET) { - if (i >= start_pos && i < end_pos) - d->latexInset(bparams, os, - texrow, rp, running_font, - basefont, outerfont, open_font, - runningChange, style, i, column); + if (i >= start_pos && (end_pos == -1 || i < end_pos)) { + d->latexInset(bparams, os, + texrow, rp, running_font, + basefont, outerfont, open_font, + runningChange, style, i, column); + } } else { - if (i >= start_pos && i < end_pos) { - try { - d->latexSpecialChar(os, rp, running_font, runningChange, - style, i, column); - } catch (EncodingException & e) { + if (i >= start_pos && (end_pos == -1 || i < end_pos)) { + try { + d->latexSpecialChar(os, rp, running_font, runningChange, + style, i, column); + } catch (EncodingException & e) { if (runparams.dryrun) { os << "<" << _("LyX Warning: ") << _("uncodable character") << " '"; diff --git a/src/Paragraph.h b/src/Paragraph.h index e6e8971dab..8c3a8f9c70 100644 --- a/src/Paragraph.h +++ b/src/Paragraph.h @@ -133,7 +133,7 @@ public: /// bool latex(BufferParams const &, Font const & outerfont, odocstream &, TexRow & texrow, OutputParams const &, - int start_pos = -1, int end_pos = -1) const; + int start_pos = 0, int end_pos = -1) const; /// Can we drop the standard paragraph wrapper? bool emptyTag() const; -- 2.39.2