- && !par.isDeleted(cur.pos() - 1)) {
- static bool sent_space_message = false;
- if (!sent_space_message) {
- cur.message(_("You cannot type two spaces this way. "
- "Please read the Tutorial."));
- sent_space_message = true;
- }
+ && !par.isDeleted(cur.pos() - 1)) {
+ cur.message(_(
+ "You cannot type two spaces this way. "
+ "Please read the Tutorial."));
+ return;
+ }
+ }
+
+ // Prevent to insert uncodable characters in verbatim and ERT
+ // (workaround for bug 9012)
+ // 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."));