[email protected] wrote:
> Modified: lyx-devel/trunk/src/Paragraph.cpp
>
==============================================================================
> --- lyx-devel/trunk/src/Paragraph.cpp Thu Mar 8 20:14:48 2012
(r40890)
> +++ lyx-devel/trunk/src/Paragraph.cpp Fri Mar 9 10:05:13 2012
(r40891)
> @@ -1253,8 +1253,9 @@
> return;
>
> Encoding const & encoding = *(runparams.encoding);
> + char_type next = '\0';
> if (i + 1 < int(text_.size())) {
> - char_type next = text_[i + 1];
> + next = text_[i + 1];
> if (Encodings::isCombiningChar(next)) {
> column += latexSurrogatePair(os, c, next, runparams) - 1;
> ++i;
> @@ -1262,18 +1263,37 @@
> }
> }
> string script;
> - docstring const latex = encoding.latexChar(c);
> + docstring latex = encoding.latexChar(c);
> + docstring nextlatex;
> + if (next != '\0' && next != META_INSET)
> + nextlatex = encoding.latexChar(next);
> + bool tipas = false;
> + if (runparams.inIPA) {
> + string const tipashortcut =
Encodings::TIPAShortcut(c);
> + if (!tipashortcut.empty()) {
> + latex = from_ascii(tipashortcut);
> + tipas = true;
> + }
> + }
> if (Encodings::isKnownScriptChar(c, script)
> && prefixIs(latex, from_ascii("\\" + script)))
> column += writeScriptChars(os, latex,
> running_change, encoding, i) - 1;
> - else if (latex.length() > 1 && latex[latex.length() - 1]
!= '}' &&
> - latex[latex.length() - 1] != '-') {
> + else if (!prefixIs(nextlatex, from_ascii("\\"))
> + && !prefixIs(nextlatex, from_ascii("{"))
> + && !prefixIs(nextlatex, from_ascii("}"))
> + && latex.length() > 1 && latex[latex.length()
- 1] != '}'
> + && latex[latex.length() - 1] != '-' &&
!tipas) {
> // Prevent eating of a following
> // space or command corruption by
> // following characters
> - column += latex.length() + 1;
> - os << latex << "{}";
> + if (next == ' ' || next == '\0') {
> + column += latex.length() + 1;
> + os << latex << "{}";
> + } else {
> + column += latex.length();
> + os << latex << " ";
> + }
> } else {
> column += latex.length() - 1;
> os << latex;
This breaks output of spaces like 0x2004: Previously, it wrote "\;{}", now
it writes "\; ". AFAIK this should be writen as "\;". The braces were not
needed, but they did not harm in this case either.
I am also unsure if this change neds adaptions in tex2lyx, since tex2lyx
skips braces in several places where it knows that LyX will add them.
Georg