]> git.lyx.org Git - lyx.git/commitdiff
Ugly fix for bug #9102
authorGeorg Baum <baum@lyx.org>
Mon, 19 May 2014 19:40:11 +0000 (21:40 +0200)
committerGeorg Baum <baum@lyx.org>
Mon, 19 May 2014 19:40:11 +0000 (21:40 +0200)
The real problem is the encoding of latex_language: It is hardcoded to latin1,
but InsetListig uses the currently active encoding. Therefore, we cannot tell
whether any given character wil be encodable or not, and we should not prevent
non-ACII characters.
In the future, we need to make the encoding of latex_language dynamic, so that
it always represents the currently active encoding. Then, we could do the
correct check both for listings and ERT. For now, I simply disabled the
encoding check for listings, which also means that bug 9012 might occur in
other cases for listings, but this is less important than bug 9102.

src/Text.cpp

index 99d9cfb6070aba5ec4a952c98e932ffbef447257..bd4e23db0af4737c6c4bdc957c47e51feab775e6 100644 (file)
@@ -1008,7 +1008,10 @@ void Text::insertChar(Cursor & cur, char_type c)
 
        // Prevent to insert uncodable characters in verbatim and ERT
        // (workaround for bug 9012)
-       if (cur.paragraph().isPassThru() && cur.current_font.language()) {
+       // Don't do it for listings inset, since InsetListings::latex() tries
+       // to switch to a usable encoding which works in many cases (bug 9102).
+       if (cur.paragraph().isPassThru() && owner_->lyxCode() != LISTINGS_CODE &&
+           cur.current_font.language()) {
                Encoding const * e = cur.current_font.language()->encoding();
                if (!e->encodable(c)) {
                        cur.message(_("Character is uncodable in verbatim paragraphs."));