]> git.lyx.org Git - lyx.git/blobdiff - src/Paragraph.cpp
Properly restore the file encoding after a LaTeX environment with local scope.
[lyx.git] / src / Paragraph.cpp
index 5f238495532eb41bd0b354e3da1561ec7bc14a73..6a0c16a1887e6e8be9b4a9fecb40e26e4d959748 100644 (file)
@@ -1960,6 +1960,8 @@ bool Paragraph::latex(BufferParams const & bparams,
 
        Change runningChange = Change(Change::UNCHANGED);
 
+       Encoding const * const prev_encoding = runparams.encoding;
+
        texrow.start(id(), 0);
 
        // if the paragraph is empty, the loop will not be entered at all
@@ -2186,10 +2188,8 @@ bool Paragraph::latex(BufferParams const & bparams,
                return_value = false;
        }
 
-       if (allowcust) {
-               column += d->endTeXParParams(bparams, os, texrow,
-                                         runparams);
-       }
+       if (allowcust && d->endTeXParParams(bparams, os, texrow,runparams))
+               runparams.encoding = prev_encoding;
 
        LYXERR(Debug::LATEX, "Paragraph::latex... done " << this);
        return return_value;
@@ -3060,7 +3060,7 @@ void Paragraph::updateWords()
 
 
 bool Paragraph::spellCheck(pos_type & from, pos_type & to, WordLangTuple & wl,
-       docstring_list & suggestions) const
+       docstring_list & suggestions, bool do_suggestion) const
 {
        SpellChecker * speller = theSpellChecker();
        if (!speller)
@@ -3088,7 +3088,7 @@ bool Paragraph::spellCheck(pos_type & from, pos_type & to, WordLangTuple & wl,
        if (lyxrc.spellcheck_continuously)
                d->fontlist_.setMisspelled(from, to, misspelled);
 
-       if (misspelled)
+       if (misspelled && do_suggestion)
                speller->suggest(wl, suggestions);
        else
                suggestions.clear();
@@ -3103,7 +3103,7 @@ bool Paragraph::isMisspelled(pos_type pos) const
        pos_type to = pos;
        WordLangTuple wl;
        docstring_list suggestions;
-       return spellCheck(from, to, wl, suggestions);
+       return spellCheck(from, to, wl, suggestions, false);
 }