To: vim-dev@vim.org Subject: Patch 6.1.116 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.116 Problem: When 'endofline' is changed while 'binary' is set a file should be considered modified. (Olaf Buddenhagen) Solution: Remember the 'eol' value when editing started and consider the file changed when the current value is different and 'binary' is set. Files: src/option.c, src/structs.h *** ../vim61.115/src/option.c Sun Jun 23 14:34:14 2002 --- src/option.c Sat Jun 29 16:30:45 2002 *************** *** 4580,4585 **** --- 4588,4596 ---- curbuf->b_p_tx = TRUE; else curbuf->b_p_tx = FALSE; + #ifdef FEAT_TITLE + need_maketitle = TRUE; + #endif } } *************** *** 5606,5625 **** if (!curbuf->b_p_ro && (opt_flags & OPT_LOCAL) == 0) readonlymode = FALSE; #ifdef FEAT_TITLE ! maketitle(); #endif } #ifdef FEAT_TITLE /* when 'modifiable' is changed, redraw the window title */ else if ((int *)varp == &curbuf->b_p_ma) ! maketitle(); #endif /* when 'bin' is set also set some other options */ else if ((int *)varp == &curbuf->b_p_bin) { set_options_bin(old_value, curbuf->b_p_bin, opt_flags); } #ifdef FEAT_AUTOCMD --- 5617,5642 ---- if (!curbuf->b_p_ro && (opt_flags & OPT_LOCAL) == 0) readonlymode = FALSE; #ifdef FEAT_TITLE ! need_maketitle = TRUE; #endif } #ifdef FEAT_TITLE /* when 'modifiable' is changed, redraw the window title */ else if ((int *)varp == &curbuf->b_p_ma) ! need_maketitle = TRUE; ! /* when 'endofline' is changed, redraw the window title */ ! else if ((int *)varp == &curbuf->b_p_eol) ! need_maketitle = TRUE; #endif /* when 'bin' is set also set some other options */ else if ((int *)varp == &curbuf->b_p_bin) { set_options_bin(old_value, curbuf->b_p_bin, opt_flags); + #ifdef FEAT_TITLE + need_maketitle = TRUE; + #endif } #ifdef FEAT_AUTOCMD *************** *** 5750,5756 **** if (!value) save_file_ff(curbuf); /* Buffer is unchanged */ #ifdef FEAT_TITLE ! maketitle(); #endif #ifdef FEAT_AUTOCMD modified_was_set = value; --- 5767,5773 ---- if (!value) save_file_ff(curbuf); /* Buffer is unchanged */ #ifdef FEAT_TITLE ! need_maketitle = TRUE; #endif #ifdef FEAT_AUTOCMD modified_was_set = value; *************** *** 6132,6138 **** p_titlelen = 85; } if (starting != NO_SCREEN && old_value != p_titlelen) ! maketitle(); } #endif --- 6149,6155 ---- p_titlelen = 85; } if (starting != NO_SCREEN && old_value != p_titlelen) ! need_maketitle = TRUE; } #endif *************** *** 8665,8670 **** --- 8685,8691 ---- buf_T *buf; { buf->b_start_ffc = *buf->b_p_ff; + buf->b_start_eol = buf->b_p_eol; #ifdef FEAT_MBYTE vim_free(buf->b_start_fenc); buf->b_start_fenc = vim_strsave(buf->b_p_fenc); *************** *** 8674,8685 **** --- 8695,8709 ---- /* * Return TRUE if 'fileformat' and/or 'fileencoding' has a different value * from when editing started (save_file_ff() called). + * Also when 'endofline' was changed and 'binary' is set. */ int file_ff_differs(buf) buf_T *buf; { if (buf->b_start_ffc != *buf->b_p_ff) + return TRUE; + if (buf->b_p_bin && buf->b_start_eol != buf->b_p_eol) return TRUE; #ifdef FEAT_MBYTE if (buf->b_start_fenc == NULL) *** ../vim61.115/src/structs.h Sun May 5 22:51:14 2002 --- src/structs.h Sat Jun 29 16:08:18 2002 *************** *** 1005,1010 **** --- 1011,1017 ---- /* end of buffer options */ + int b_start_eol; /* last line had eol when it was read */ int b_start_ffc; /* first char of 'ff' when edit started */ #ifdef FEAT_MBYTE char_u *b_start_fenc; /* 'fileencoding' when edit started or NULL */ *** ../vim61.115/src/version.c Sat Jun 29 15:57:43 2002 --- src/version.c Sat Jun 29 16:32:19 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 116, /**/ -- ARTHUR: What? BLACK KNIGHT: None shall pass. ARTHUR: I have no quarrel with you, good Sir knight, but I must cross this bridge. BLACK KNIGHT: Then you shall die. The Quest for the Holy Grail (Monty Python) /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\ \\\ Project leader for A-A-P -- http://www.a-a-p.org /// \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///