d4e77d5
To: vim-dev@vim.org
d4e77d5
Subject: patch 7.1.066
d4e77d5
Fcc: outbox
d4e77d5
From: Bram Moolenaar <Bram@moolenaar.net>
d4e77d5
Mime-Version: 1.0
d4e77d5
Content-Type: text/plain; charset=ISO-8859-1
d4e77d5
Content-Transfer-Encoding: 8bit
d4e77d5
------------
d4e77d5
d4e77d5
Patch 7.1.066
d4e77d5
Problem:    When 'bomb' is set or reset the file should be considered
d4e77d5
	    modified.  (Tony Mechelynck)
d4e77d5
Solution:   Handle like 'endofline'. (Martin Toft)
d4e77d5
Files:	    src/buffer.c, src/fileio.c, src/option.c, src/structs.h
d4e77d5
d4e77d5
d4e77d5
*** ../vim-7.1.065/src/buffer.c	Mon Aug  6 22:27:12 2007
d4e77d5
--- src/buffer.c	Sat Aug 11 16:56:57 2007
d4e77d5
***************
d4e77d5
*** 502,507 ****
d4e77d5
--- 502,508 ----
d4e77d5
      buf->b_start_eol = TRUE;
d4e77d5
  #ifdef FEAT_MBYTE
d4e77d5
      buf->b_p_bomb = FALSE;
d4e77d5
+     buf->b_start_bomb = FALSE;
d4e77d5
  #endif
d4e77d5
      buf->b_ml.ml_mfp = NULL;
d4e77d5
      buf->b_ml.ml_flags = ML_EMPTY;		/* empty buffer */
d4e77d5
*** ../vim-7.1.065/src/fileio.c	Tue Jul 10 17:09:51 2007
d4e77d5
--- src/fileio.c	Sat Aug 11 16:56:57 2007
d4e77d5
***************
d4e77d5
*** 654,659 ****
d4e77d5
--- 654,660 ----
d4e77d5
  	curbuf->b_start_eol = TRUE;
d4e77d5
  #ifdef FEAT_MBYTE
d4e77d5
  	curbuf->b_p_bomb = FALSE;
d4e77d5
+ 	curbuf->b_start_bomb = FALSE;
d4e77d5
  #endif
d4e77d5
      }
d4e77d5
  
d4e77d5
***************
d4e77d5
*** 912,918 ****
d4e77d5
--- 913,922 ----
d4e77d5
  	file_rewind = FALSE;
d4e77d5
  #ifdef FEAT_MBYTE
d4e77d5
  	if (set_options)
d4e77d5
+ 	{
d4e77d5
  	    curbuf->b_p_bomb = FALSE;
d4e77d5
+ 	    curbuf->b_start_bomb = FALSE;
d4e77d5
+ 	}
d4e77d5
  	conv_error = 0;
d4e77d5
  #endif
d4e77d5
      }
d4e77d5
***************
d4e77d5
*** 1361,1367 ****
d4e77d5
--- 1365,1374 ----
d4e77d5
  		    size -= blen;
d4e77d5
  		    mch_memmove(ptr, ptr + blen, (size_t)size);
d4e77d5
  		    if (set_options)
d4e77d5
+ 		    {
d4e77d5
  			curbuf->b_p_bomb = TRUE;
d4e77d5
+ 			curbuf->b_start_bomb = TRUE;
d4e77d5
+ 		    }
d4e77d5
  		}
d4e77d5
  
d4e77d5
  		if (fio_flags == FIO_UCSBOM)
d4e77d5
*** ../vim-7.1.065/src/option.c	Tue Jul 24 14:57:16 2007
d4e77d5
--- src/option.c	Sat Aug 11 16:56:57 2007
d4e77d5
***************
d4e77d5
*** 7118,7123 ****
d4e77d5
--- 7118,7128 ----
d4e77d5
      /* when 'endofline' is changed, redraw the window title */
d4e77d5
      else if ((int *)varp == &curbuf->b_p_eol)
d4e77d5
  	need_maketitle = TRUE;
d4e77d5
+ #ifdef FEAT_MBYTE
d4e77d5
+     /* when 'bomb' is changed, redraw the window title */
d4e77d5
+     else if ((int *)varp == &curbuf->b_p_bomb)
d4e77d5
+ 	need_maketitle = TRUE;
d4e77d5
+ #endif
d4e77d5
  #endif
d4e77d5
  
d4e77d5
      /* when 'bin' is set also set some other options */
d4e77d5
***************
d4e77d5
*** 10604,10609 ****
d4e77d5
--- 10609,10616 ----
d4e77d5
      buf->b_start_ffc = *buf->b_p_ff;
d4e77d5
      buf->b_start_eol = buf->b_p_eol;
d4e77d5
  #ifdef FEAT_MBYTE
d4e77d5
+     buf->b_start_bomb = buf->b_p_bomb;
d4e77d5
+ 
d4e77d5
      /* Only use free/alloc when necessary, they take time. */
d4e77d5
      if (buf->b_start_fenc == NULL
d4e77d5
  			     || STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0)
d4e77d5
***************
d4e77d5
*** 10617,10623 ****
d4e77d5
  /*
d4e77d5
   * Return TRUE if 'fileformat' and/or 'fileencoding' has a different value
d4e77d5
   * from when editing started (save_file_ff() called).
d4e77d5
!  * Also when 'endofline' was changed and 'binary' is set.
d4e77d5
   * Don't consider a new, empty buffer to be changed.
d4e77d5
   */
d4e77d5
      int
d4e77d5
--- 10624,10631 ----
d4e77d5
  /*
d4e77d5
   * Return TRUE if 'fileformat' and/or 'fileencoding' has a different value
d4e77d5
   * from when editing started (save_file_ff() called).
d4e77d5
!  * Also when 'endofline' was changed and 'binary' is set, or when 'bomb' was
d4e77d5
!  * changed and 'binary' is not set.
d4e77d5
   * Don't consider a new, empty buffer to be changed.
d4e77d5
   */
d4e77d5
      int
d4e77d5
***************
d4e77d5
*** 10636,10641 ****
d4e77d5
--- 10644,10651 ----
d4e77d5
      if (buf->b_p_bin && buf->b_start_eol != buf->b_p_eol)
d4e77d5
  	return TRUE;
d4e77d5
  #ifdef FEAT_MBYTE
d4e77d5
+     if (!buf->b_p_bin && buf->b_start_bomb != buf->b_p_bomb)
d4e77d5
+ 	return TRUE;
d4e77d5
      if (buf->b_start_fenc == NULL)
d4e77d5
  	return (*buf->b_p_fenc != NUL);
d4e77d5
      return (STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0);
d4e77d5
*** ../vim-7.1.065/src/structs.h	Thu Jul 26 22:55:11 2007
d4e77d5
--- src/structs.h	Sat Aug 11 16:56:57 2007
d4e77d5
***************
d4e77d5
*** 1453,1458 ****
d4e77d5
--- 1453,1459 ----
d4e77d5
  #ifdef FEAT_MBYTE
d4e77d5
      char_u	*b_start_fenc;	/* 'fileencoding' when edit started or NULL */
d4e77d5
      int		b_bad_char;	/* "++bad=" argument when edit started or 0 */
d4e77d5
+     int		b_start_bomb;	/* 'bomb' when it was read */
d4e77d5
  #endif
d4e77d5
  
d4e77d5
  #ifdef FEAT_EVAL
d4e77d5
*** ../vim-7.1.065/src/version.c	Sun Aug 12 15:24:05 2007
d4e77d5
--- src/version.c	Sun Aug 12 15:48:34 2007
d4e77d5
***************
d4e77d5
*** 668,669 ****
d4e77d5
--- 668,671 ----
d4e77d5
  {   /* Add new patch number below this line */
d4e77d5
+ /**/
d4e77d5
+     66,
d4e77d5
  /**/
d4e77d5
d4e77d5
-- 
d4e77d5
hundred-and-one symptoms of being an internet addict:
d4e77d5
127. You bring your laptop and cellular phone to church.
d4e77d5
d4e77d5
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
d4e77d5
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
d4e77d5
\\\        download, build and distribute -- http://www.A-A-P.org        ///
d4e77d5
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///