]> git.lyx.org Git - lyx.git/blobdiff - src/paragraph_pimpl.C
* src/frontends/qt4/ui/QPrefCygwinPathUi.ui:
[lyx.git] / src / paragraph_pimpl.C
index 1ece42dadb61f5810e112abdce7e95087214ce8f..09feac95344b09d5e7e0bc9c718948d147b6d64d 100644 (file)
@@ -62,6 +62,10 @@ size_t const phrases_nr = sizeof(special_phrases)/sizeof(special_phrase);
 bool isEncoding(BufferParams const & bparams, LyXFont const & font,
                string const & encoding)
 {
+       // We do ignore bparams.inputenc == "default" here because characters
+       // in this encoding could be treated by TeX as something different,
+       // e.g. if they are inside a CJK environment. See also
+       // http://bugzilla.lyx.org/show_bug.cgi?id=3043.
        return (bparams.inputenc == encoding
                || (bparams.inputenc == "auto"
                    && font.language()->encoding()->latexName() == encoding));
@@ -151,7 +155,7 @@ void Paragraph::Pimpl::setChange(pos_type pos, Change const & change)
 }
 
 
-Change const Paragraph::Pimpl::lookupChange(pos_type pos) const
+Change const Paragraph::Pimpl::lookupChange(pos_type pos) const
 {
        BOOST_ASSERT(pos >= 0 && pos <= size());
 
@@ -163,14 +167,23 @@ void Paragraph::Pimpl::acceptChanges(pos_type start, pos_type end)
 {
        BOOST_ASSERT(start >= 0 && start <= size());
        BOOST_ASSERT(end > start && end <= size() + 1);
-       
+
        for (pos_type pos = start; pos < end; ++pos) {
                switch (lookupChange(pos).type) {
                        case Change::UNCHANGED:
+                               // accept changes in nested inset
+                               if (pos < size() && owner_->isInset(pos)) {
+                                       owner_->getInset(pos)->acceptChanges();
+                               }
+
                                break;
 
                        case Change::INSERTED:
                                changes_.set(Change(Change::UNCHANGED), pos);
+                               // also accept changes in nested inset
+                               if (pos < size() && owner_->isInset(pos)) {
+                                       owner_->getInset(pos)->acceptChanges();
+                               }
                                break;
 
                        case Change::DELETED:
@@ -184,10 +197,6 @@ void Paragraph::Pimpl::acceptChanges(pos_type start, pos_type end)
                                break;
                }
 
-               // also accept changes in nested insets
-               if (pos < size() && owner_->isInset(pos)) {
-                       owner_->getInset(pos)->acceptChanges();
-               }
        }
 }
 
@@ -200,7 +209,7 @@ void Paragraph::Pimpl::rejectChanges(pos_type start, pos_type end)
        for (pos_type pos = start; pos < end; ++pos) {
                switch (lookupChange(pos).type) {
                        case Change::UNCHANGED:
-                               // also reject changes inside of insets
+                               // reject changes in nested inset
                                if (pos < size() && owner_->isInset(pos)) {
                                        owner_->getInset(pos)->rejectChanges();
                                }
@@ -381,7 +390,7 @@ void Paragraph::Pimpl::simpleTeXBlanks(odocstream & os, TexRow & texrow,
        if (style.pass_thru)
                return;
 
-       if (column > lyxrc.ascii_linelen
+       if (column > lyxrc.plaintext_linelen
            && i
            && getChar(i - 1) != ' '
            && (i < size() - 1)
@@ -478,7 +487,8 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf,
                                os << '\n';
                        } else {
                                if (open_font) {
-                                       column += running_font.latexWriteEndChanges(os, basefont, basefont);
+                                       column += running_font.latexWriteEndChanges(
+                                               os, basefont, basefont, bparams);
                                        open_font = false;
                                }
                                basefont = owner_->getLayoutFont(bparams, outerfont);
@@ -531,10 +541,8 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf,
 #endif
                // some insets cannot be inside a font change command
                if (open_font && inset->noFontChange()) {
-                       column +=running_font.
-                               latexWriteEndChanges(os,
-                                                    basefont,
-                                                    basefont);
+                       column += running_font.latexWriteEndChanges(
+                                       os, basefont, basefont, bparams);
                        open_font = false;
                        basefont = owner_->getLayoutFont(bparams, outerfont);
                        running_font = basefont;
@@ -658,7 +666,9 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf,
                case 0x20ac:    // EURO SIGN
                        if (isEncoding(bparams, font, "latin9")
                            || isEncoding(bparams, font, "cp1251")
-                           || isEncoding(bparams, font, "utf8")) {
+                           || isEncoding(bparams, font, "utf8")
+                           || isEncoding(bparams, font, "latin10")
+                           || isEncoding(bparams, font, "cp858")) {
                                os.put(c);
                        } else {
                                os << "\\texteuro{}";
@@ -816,7 +826,7 @@ void Paragraph::Pimpl::validate(LaTeXFeatures & features,
                                             << endl;
                        features.require("noun");
                        lyxerr[Debug::LATEX] << "Noun enabled. Font: "
-                                            << fcit->font().stateText(0)
+                                            << to_utf8(fcit->font().stateText(0))
                                             << endl;
                }
                switch (fcit->font().color()) {
@@ -831,7 +841,7 @@ void Paragraph::Pimpl::validate(LaTeXFeatures & features,
                default:
                        features.require("color");
                        lyxerr[Debug::LATEX] << "Color enabled. Font: "
-                                            << fcit->font().stateText(0)
+                                            << to_utf8(fcit->font().stateText(0))
                                             << endl;
                }