Loading ...
Sorry, an error occurred while loading the content.

Patch 6.1.436

Expand Messages
  • Bram Moolenaar
    Patch 6.1.436 Problem: When a long UTF-8 file contains an illegal byte it s hard to find out where it is. (Ron Aaron) Solution: Add the line number to the
    Message 1 of 1 , Apr 6, 2003
    • 0 Attachment
      Patch 6.1.436
      Problem: When a long UTF-8 file contains an illegal byte it's hard to find
      out where it is. (Ron Aaron)
      Solution: Add the line number to the error message.
      Files: src/fileio.c


      *** ../vim61.435/src/fileio.c Sat Mar 15 17:55:18 2003
      --- src/fileio.c Wed Apr 2 20:25:31 2003
      ***************
      *** 263,269 ****
      #ifdef FEAT_MBYTE
      int can_retry;
      int conv_error = FALSE; /* conversion error detected */
      ! int illegal_byte = FALSE; /* illegal byte detected */
      char_u *tmpname = NULL; /* name of 'charconvert' output file */
      int fio_flags = 0;
      char_u *fenc; /* fileencoding to use */
      --- 263,269 ----
      #ifdef FEAT_MBYTE
      int can_retry;
      int conv_error = FALSE; /* conversion error detected */
      ! linenr_T illegal_byte = 0; /* line nr with illegal byte */
      char_u *tmpname = NULL; /* name of 'charconvert' output file */
      int fio_flags = 0;
      char_u *fenc; /* fileencoding to use */
      ***************
      *** 1542,1548 ****
      conv_error = TRUE;
      else
      # endif
      ! illegal_byte = TRUE;
      }
      }
      #endif
      --- 1542,1556 ----
      conv_error = TRUE;
      else
      # endif
      ! {
      ! char_u *s;
      !
      ! /* Estimate the line number. */
      ! illegal_byte = curbuf->b_ml.ml_line_count - linecnt + 1;
      ! for (s = ptr; s < p; ++s)
      ! if (*s == '\n')
      ! ++illegal_byte;
      ! }
      }
      }
      #endif
      ***************
      *** 1930,1938 ****
      STRCAT(IObuff, _("[CONVERSION ERROR]"));
      c = TRUE;
      }
      ! else if (illegal_byte)
      {
      ! STRCAT(IObuff, _("[ILLEGAL BYTE]"));
      c = TRUE;
      }
      else
      --- 1938,1947 ----
      STRCAT(IObuff, _("[CONVERSION ERROR]"));
      c = TRUE;
      }
      ! else if (illegal_byte > 0)
      {
      ! sprintf((char *)IObuff + STRLEN(IObuff),
      ! _("[ILLEGAL BYTE in line %ld]"), (long)illegal_byte);
      c = TRUE;
      }
      else
      *** ../vim61.435/src/version.c Tue Apr 1 22:08:53 2003
      --- src/version.c Sun Apr 6 14:19:32 2003
      ***************
      *** 613,614 ****
      --- 613,616 ----
      { /* Add new patch number below this line */
      + /**/
      + 436,
      /**/

      --
      Did you ever stop to think... and forget to start again?
      -- Steven Wright

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
      \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
      \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///
    Your message has been successfully submitted and would be delivered to recipients shortly.