From: Jean-Marc Lasgouttes Date: Wed, 29 May 2002 22:07:59 +0000 (+0000) Subject: fix bugs 357 and 407; speedup Paragraph::Pimpl::isTextAt X-Git-Tag: 1.6.10~19170 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=df279e7596b3a3f640f506d3681f9709dcd09e0a;p=features.git fix bugs 357 and 407; speedup Paragraph::Pimpl::isTextAt git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4285 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/lib/ChangeLog b/lib/ChangeLog index e812ffb51f..3551398669 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2002-05-29 Jean-Marc Lasgouttes + + * configure.m4: fix handling of --with-version-suffix, so that + reLyX is still found. (bug #357) + 2002-05-28 Jean-Marc Lasgouttes * layouts/hollywood.layout: fix style "FADE_OUT:" diff --git a/lib/configure.m4 b/lib/configure.m4 index 6ce98bb726..df123826d9 100644 --- a/lib/configure.m4 +++ b/lib/configure.m4 @@ -100,7 +100,7 @@ rc_entries= lyx_check_config=yes lyx_keep_temps=no srcdir= -lyx_suffix= +version_suffix= #### Parse the command line for ac_option do @@ -112,15 +112,15 @@ Options: --help show this help lines --keep-temps keep temporary files (for debug. purposes) --without-latex-config do not run LaTeX to determine configuration - --with-lyx-suffix=suffix suffix of binary installed files + --with-version-suffix=suffix suffix of binary installed files EOF exit 0;; --without-latex-config) lyx_check_config=no ;; --keep-temps) lyx_keep_temps=yes ;; - --with-lyx-suffix*) - lyx_suffix=`echo "$ac_option" | sed 's,--with-lyx-suffix=,,;s,^,-,'` + --with-version-suffix*) + version_suffix=`echo "$ac_option" | sed 's,--with-version-suffix=,,'` esac done @@ -219,11 +219,11 @@ PATH=${PATH}:./reLyX/ SEARCH_PROG([for a LaTeX -> LyX converter],tex_to_lyx_command,reLyX) PATH=${save_PATH} test $tex_to_lyx_command = "reLyX" && tex_to_lyx_command="reLyX -f \$\$i" -tex_to_lyx_command=`echo $tex_to_lyx_command | sed "s,reLyX,reLyX$lyx_suffix,"` +tex_to_lyx_command=`echo $tex_to_lyx_command | sed "s,reLyX,reLyX$version_suffix,"` SEARCH_PROG([for a Noweb -> LyX converter],literate_to_lyx_command,noweb2lyx) test $literate_to_lyx_command = "noweb2lyx" && literate_to_lyx_command="noweb2lyx \$\$i \$\$o" -literate_to_lyx_command=`echo $literate_to_lyx_command | sed "s,noweb2lyx,noweb2lyx$lyx_suffix,"` +literate_to_lyx_command=`echo $literate_to_lyx_command | sed "s,noweb2lyx,noweb2lyx$version_suffix,"` # Search something to process a literate document SEARCH_PROG([for a Noweb -> LaTeX converter],literate_to_tex_command,noweave) diff --git a/src/ChangeLog b/src/ChangeLog index 2536336098..d9557742e1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2002-05-29 Jean-Marc Lasgouttes + + * paragraph_pimpl.C (isTextAt): rewrite to be much faster (do not + call getFont all the time) + 2002-05-29 Lars Gullik Bjønnes * switch from SigC signals to boost::signals diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index b23d272276..a04ca44186 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,9 @@ +2002-05-29 Jean-Marc Lasgouttes + + * insetgraphicsParams.C (Read): use lyxlex::eatLine to read the + file name, in case there are weird characters like ',' in there. + (bug #407) + 2002-05-29 Lars Gullik Bjønnes * switch from SigC signals to boost::signals. diff --git a/src/insets/insetgraphicsParams.C b/src/insets/insetgraphicsParams.C index 41c61fdb78..43d2057e65 100644 --- a/src/insets/insetgraphicsParams.C +++ b/src/insets/insetgraphicsParams.C @@ -221,7 +221,7 @@ void InsetGraphicsParams::Write(ostream & os) const bool InsetGraphicsParams::Read(LyXLex & lex, string const & token) { if (token == "filename") { - lex.next(); + lex.eatLine(); filename = lex.getString(); } else if (token == "BoundingBox") { for (int i=0; i<4 ;i++) { diff --git a/src/paragraph_pimpl.C b/src/paragraph_pimpl.C index bbc9f87be8..4f662fe182 100644 --- a/src/paragraph_pimpl.C +++ b/src/paragraph_pimpl.C @@ -275,19 +275,30 @@ void Paragraph::Pimpl::simpleTeXBlanks(ostream & os, TexRow & texrow, } -bool Paragraph::Pimpl::isTextAt(BufferParams const & bp, - string const & str, pos_type pos) +bool Paragraph::Pimpl::isTextAt(string const & str, pos_type pos) { - LyXFont const & font = owner_->getFont(bp, pos); + pos_type const len = str.length(); + + // is the paragraph large enough? + if (pos + len > size()) + return false; + // does the wanted text start at point? for (string::size_type i = 0; i < str.length(); ++i) { - if (pos + static_cast(i) >= size()) - return false; - if (str[i] != getChar(pos + i)) - return false; - if (owner_->getFont(bp, pos + i) != font) + if (str[i] != text[pos + i]) return false; } + + // is there a font change in middle of the word? + FontList::const_iterator cit = fontlist.begin(); + FontList::const_iterator end = fontlist.end(); + for (; cit != end; ++cit) { + if (cit->pos() >= pos) + break; + } + if (cit != end && pos + len - 1 > cit->pos()) + return false; + return true; } @@ -507,7 +518,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf, size_t pnr = 0; for (; pnr < phrases_nr; ++pnr) { - if (isTextAt(bparams, special_phrases[pnr][0], i)) { + if (isTextAt(special_phrases[pnr][0], i)) { os << special_phrases[pnr][1]; i += special_phrases[pnr][0].length() - 1; column += special_phrases[pnr][1].length() - 1; diff --git a/src/paragraph_pimpl.h b/src/paragraph_pimpl.h index c504bc85aa..efbbd7046f 100644 --- a/src/paragraph_pimpl.h +++ b/src/paragraph_pimpl.h @@ -151,8 +151,7 @@ struct Paragraph::Pimpl { ParagraphParameters params; private: /// match a string against a particular point in the paragraph - bool isTextAt(BufferParams const &, - string const & str, lyx::pos_type pos); + bool isTextAt(string const & str, lyx::pos_type pos); /// Who owns us? Paragraph * owner_;