]> code.delx.au - gnu-emacs/blobdiff - src/coding.c
Sync x-server-* and x-display-* functions on NS with those on X11.
[gnu-emacs] / src / coding.c
index f9799035b3c293b9c02b4106f81373fe25bc4509..f6664e179b7271295e2a24171c565c8d2d2e67b2 100644 (file)
@@ -3887,6 +3887,14 @@ decode_coding_iso_2022 (struct coding_system *coding)
       *charbuf++ = c < 0 ? -c : ASCII_BYTE_P (c) ? c : BYTE8_TO_CHAR (c);
       char_offset++;
       coding->errors++;
+      /* Reset the invocation and designation status to the safest
+        one; i.e. designate ASCII to the graphic register 0, and
+        invoke that register to the graphic plane 0.  This typically
+        helps the case that an designation sequence for ASCII "ESC (
+        B" is somehow broken (e.g. broken by a newline).  */
+      CODING_ISO_INVOCATION (coding, 0) = 0;
+      CODING_ISO_DESIGNATION (coding, 0) = charset_ascii;
+      charset_id_0 = charset_ascii;
       continue;
 
     break_loop:
@@ -7766,7 +7774,7 @@ decode_coding_gap (struct coding_system *coding,
              while (src_beg < src)
                {
                  *--dst = *--src;
-                 if (*src == '\n')
+                 if (*src == '\n' && src > src_beg && src[-1] == '\r')
                    src--;
                }
              diff = dst - src;