|
Karsten Hopp |
b96ca6 |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
b96ca6 |
Subject: Patch 7.3.124
|
|
Karsten Hopp |
b96ca6 |
Fcc: outbox
|
|
Karsten Hopp |
b96ca6 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
b96ca6 |
Mime-Version: 1.0
|
|
Karsten Hopp |
b96ca6 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
b96ca6 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
b96ca6 |
------------
|
|
Karsten Hopp |
b96ca6 |
|
|
Karsten Hopp |
b96ca6 |
Patch 7.3.124
|
|
Karsten Hopp |
b96ca6 |
Problem: When writing a file in binary mode it may be missing the final EOL
|
|
Karsten Hopp |
b96ca6 |
if a file previously read was missing the EOL. (Kevin Goodsell)
|
|
Karsten Hopp |
b96ca6 |
Solution: Move the write_no_eol_lnum into the buffer struct.
|
|
Karsten Hopp |
b96ca6 |
Files: src/structs.h, src/fileio.c, src/globals.h, src/os_unix.c
|
|
Karsten Hopp |
b96ca6 |
|
|
Karsten Hopp |
b96ca6 |
|
|
Karsten Hopp |
b96ca6 |
*** ../vim-7.3.123/src/structs.h 2010-10-20 21:22:17.000000000 +0200
|
|
Karsten Hopp |
b96ca6 |
--- src/structs.h 2011-02-15 17:06:34.000000000 +0100
|
|
Karsten Hopp |
b96ca6 |
***************
|
|
Karsten Hopp |
b96ca6 |
*** 1564,1569 ****
|
|
Karsten Hopp |
b96ca6 |
--- 1564,1572 ----
|
|
Karsten Hopp |
b96ca6 |
|
|
Karsten Hopp |
b96ca6 |
/* end of buffer options */
|
|
Karsten Hopp |
b96ca6 |
|
|
Karsten Hopp |
b96ca6 |
+ linenr_T b_no_eol_lnum; /* non-zero lnum when last line of next binary
|
|
Karsten Hopp |
b96ca6 |
+ * write should not have an end-of-line */
|
|
Karsten Hopp |
b96ca6 |
+
|
|
Karsten Hopp |
b96ca6 |
int b_start_eol; /* last line had eol when it was read */
|
|
Karsten Hopp |
b96ca6 |
int b_start_ffc; /* first char of 'ff' when edit started */
|
|
Karsten Hopp |
b96ca6 |
#ifdef FEAT_MBYTE
|
|
Karsten Hopp |
b96ca6 |
*** ../vim-7.3.123/src/fileio.c 2011-02-09 16:44:45.000000000 +0100
|
|
Karsten Hopp |
b96ca6 |
--- src/fileio.c 2011-02-15 17:30:54.000000000 +0100
|
|
Karsten Hopp |
b96ca6 |
***************
|
|
Karsten Hopp |
b96ca6 |
*** 317,323 ****
|
|
Karsten Hopp |
b96ca6 |
int using_b_fname;
|
|
Karsten Hopp |
b96ca6 |
#endif
|
|
Karsten Hopp |
b96ca6 |
|
|
Karsten Hopp |
b96ca6 |
! write_no_eol_lnum = 0; /* in case it was set by the previous read */
|
|
Karsten Hopp |
b96ca6 |
|
|
Karsten Hopp |
b96ca6 |
/*
|
|
Karsten Hopp |
b96ca6 |
* If there is no file name yet, use the one for the read file.
|
|
Karsten Hopp |
b96ca6 |
--- 317,323 ----
|
|
Karsten Hopp |
b96ca6 |
int using_b_fname;
|
|
Karsten Hopp |
b96ca6 |
#endif
|
|
Karsten Hopp |
b96ca6 |
|
|
Karsten Hopp |
b96ca6 |
! curbuf->b_no_eol_lnum = 0; /* in case it was set by the previous read */
|
|
Karsten Hopp |
b96ca6 |
|
|
Karsten Hopp |
b96ca6 |
/*
|
|
Karsten Hopp |
b96ca6 |
* If there is no file name yet, use the one for the read file.
|
|
Karsten Hopp |
b96ca6 |
***************
|
|
Karsten Hopp |
b96ca6 |
*** 2599,2608 ****
|
|
Karsten Hopp |
b96ca6 |
|
|
Karsten Hopp |
b96ca6 |
/*
|
|
Karsten Hopp |
b96ca6 |
* Trick: We remember if the last line of the read didn't have
|
|
Karsten Hopp |
b96ca6 |
! * an eol for when writing it again. This is required for
|
|
Karsten Hopp |
b96ca6 |
* ":autocmd FileReadPost *.gz set bin|'[,']!gunzip" to work.
|
|
Karsten Hopp |
b96ca6 |
*/
|
|
Karsten Hopp |
b96ca6 |
! write_no_eol_lnum = read_no_eol_lnum;
|
|
Karsten Hopp |
b96ca6 |
|
|
Karsten Hopp |
b96ca6 |
/* When reloading a buffer put the cursor at the first line that is
|
|
Karsten Hopp |
b96ca6 |
* different. */
|
|
Karsten Hopp |
b96ca6 |
--- 2599,2609 ----
|
|
Karsten Hopp |
b96ca6 |
|
|
Karsten Hopp |
b96ca6 |
/*
|
|
Karsten Hopp |
b96ca6 |
* Trick: We remember if the last line of the read didn't have
|
|
Karsten Hopp |
b96ca6 |
! * an eol even when 'binary' is off, for when writing it again with
|
|
Karsten Hopp |
b96ca6 |
! * 'binary' on. This is required for
|
|
Karsten Hopp |
b96ca6 |
* ":autocmd FileReadPost *.gz set bin|'[,']!gunzip" to work.
|
|
Karsten Hopp |
b96ca6 |
*/
|
|
Karsten Hopp |
b96ca6 |
! curbuf->b_no_eol_lnum = read_no_eol_lnum;
|
|
Karsten Hopp |
b96ca6 |
|
|
Karsten Hopp |
b96ca6 |
/* When reloading a buffer put the cursor at the first line that is
|
|
Karsten Hopp |
b96ca6 |
* different. */
|
|
Karsten Hopp |
b96ca6 |
***************
|
|
Karsten Hopp |
b96ca6 |
*** 2650,2662 ****
|
|
Karsten Hopp |
b96ca6 |
FALSE, NULL, eap);
|
|
Karsten Hopp |
b96ca6 |
if (msg_scrolled == n)
|
|
Karsten Hopp |
b96ca6 |
msg_scroll = m;
|
|
Karsten Hopp |
b96ca6 |
! #ifdef FEAT_EVAL
|
|
Karsten Hopp |
b96ca6 |
if (aborting()) /* autocmds may abort script processing */
|
|
Karsten Hopp |
b96ca6 |
return FAIL;
|
|
Karsten Hopp |
b96ca6 |
! #endif
|
|
Karsten Hopp |
b96ca6 |
}
|
|
Karsten Hopp |
b96ca6 |
#endif
|
|
Karsten Hopp |
b96ca6 |
|
|
Karsten Hopp |
b96ca6 |
if (recoverymode && error)
|
|
Karsten Hopp |
b96ca6 |
return FAIL;
|
|
Karsten Hopp |
b96ca6 |
return OK;
|
|
Karsten Hopp |
b96ca6 |
--- 2651,2667 ----
|
|
Karsten Hopp |
b96ca6 |
FALSE, NULL, eap);
|
|
Karsten Hopp |
b96ca6 |
if (msg_scrolled == n)
|
|
Karsten Hopp |
b96ca6 |
msg_scroll = m;
|
|
Karsten Hopp |
b96ca6 |
! # ifdef FEAT_EVAL
|
|
Karsten Hopp |
b96ca6 |
if (aborting()) /* autocmds may abort script processing */
|
|
Karsten Hopp |
b96ca6 |
return FAIL;
|
|
Karsten Hopp |
b96ca6 |
! # endif
|
|
Karsten Hopp |
b96ca6 |
}
|
|
Karsten Hopp |
b96ca6 |
#endif
|
|
Karsten Hopp |
b96ca6 |
|
|
Karsten Hopp |
b96ca6 |
+ /* Reset now, following writes should not omit the EOL. Also, the line
|
|
Karsten Hopp |
b96ca6 |
+ * number will become invalid because of edits. */
|
|
Karsten Hopp |
b96ca6 |
+ curbuf->b_no_eol_lnum = 0;
|
|
Karsten Hopp |
b96ca6 |
+
|
|
Karsten Hopp |
b96ca6 |
if (recoverymode && error)
|
|
Karsten Hopp |
b96ca6 |
return FAIL;
|
|
Karsten Hopp |
b96ca6 |
return OK;
|
|
Karsten Hopp |
b96ca6 |
***************
|
|
Karsten Hopp |
b96ca6 |
*** 4560,4566 ****
|
|
Karsten Hopp |
b96ca6 |
if (end == 0
|
|
Karsten Hopp |
b96ca6 |
|| (lnum == end
|
|
Karsten Hopp |
b96ca6 |
&& write_bin
|
|
Karsten Hopp |
b96ca6 |
! && (lnum == write_no_eol_lnum
|
|
Karsten Hopp |
b96ca6 |
|| (lnum == buf->b_ml.ml_line_count && !buf->b_p_eol))))
|
|
Karsten Hopp |
b96ca6 |
{
|
|
Karsten Hopp |
b96ca6 |
++lnum; /* written the line, count it */
|
|
Karsten Hopp |
b96ca6 |
--- 4565,4571 ----
|
|
Karsten Hopp |
b96ca6 |
if (end == 0
|
|
Karsten Hopp |
b96ca6 |
|| (lnum == end
|
|
Karsten Hopp |
b96ca6 |
&& write_bin
|
|
Karsten Hopp |
b96ca6 |
! && (lnum == buf->b_no_eol_lnum
|
|
Karsten Hopp |
b96ca6 |
|| (lnum == buf->b_ml.ml_line_count && !buf->b_p_eol))))
|
|
Karsten Hopp |
b96ca6 |
{
|
|
Karsten Hopp |
b96ca6 |
++lnum; /* written the line, count it */
|
|
Karsten Hopp |
b96ca6 |
***************
|
|
Karsten Hopp |
b96ca6 |
*** 5086,5093 ****
|
|
Karsten Hopp |
b96ca6 |
{
|
|
Karsten Hopp |
b96ca6 |
aco_save_T aco;
|
|
Karsten Hopp |
b96ca6 |
|
|
Karsten Hopp |
b96ca6 |
- write_no_eol_lnum = 0; /* in case it was set by the previous read */
|
|
Karsten Hopp |
b96ca6 |
-
|
|
Karsten Hopp |
b96ca6 |
/*
|
|
Karsten Hopp |
b96ca6 |
* Apply POST autocommands.
|
|
Karsten Hopp |
b96ca6 |
* Careful: The autocommands may call buf_write() recursively!
|
|
Karsten Hopp |
b96ca6 |
--- 5091,5096 ----
|
|
Karsten Hopp |
b96ca6 |
***************
|
|
Karsten Hopp |
b96ca6 |
*** 7256,7263 ****
|
|
Karsten Hopp |
b96ca6 |
write_lnum_adjust(offset)
|
|
Karsten Hopp |
b96ca6 |
linenr_T offset;
|
|
Karsten Hopp |
b96ca6 |
{
|
|
Karsten Hopp |
b96ca6 |
! if (write_no_eol_lnum != 0) /* only if there is a missing eol */
|
|
Karsten Hopp |
b96ca6 |
! write_no_eol_lnum += offset;
|
|
Karsten Hopp |
b96ca6 |
}
|
|
Karsten Hopp |
b96ca6 |
|
|
Karsten Hopp |
b96ca6 |
#if defined(TEMPDIRNAMES) || defined(PROTO)
|
|
Karsten Hopp |
b96ca6 |
--- 7259,7266 ----
|
|
Karsten Hopp |
b96ca6 |
write_lnum_adjust(offset)
|
|
Karsten Hopp |
b96ca6 |
linenr_T offset;
|
|
Karsten Hopp |
b96ca6 |
{
|
|
Karsten Hopp |
b96ca6 |
! if (curbuf->b_no_eol_lnum != 0) /* only if there is a missing eol */
|
|
Karsten Hopp |
b96ca6 |
! curbuf->b_no_eol_lnum += offset;
|
|
Karsten Hopp |
b96ca6 |
}
|
|
Karsten Hopp |
b96ca6 |
|
|
Karsten Hopp |
b96ca6 |
#if defined(TEMPDIRNAMES) || defined(PROTO)
|
|
Karsten Hopp |
b96ca6 |
*** ../vim-7.3.123/src/globals.h 2010-12-02 21:43:10.000000000 +0100
|
|
Karsten Hopp |
b96ca6 |
--- src/globals.h 2011-02-15 17:06:06.000000000 +0100
|
|
Karsten Hopp |
b96ca6 |
***************
|
|
Karsten Hopp |
b96ca6 |
*** 1057,1066 ****
|
|
Karsten Hopp |
b96ca6 |
;
|
|
Karsten Hopp |
b96ca6 |
#endif
|
|
Karsten Hopp |
b96ca6 |
|
|
Karsten Hopp |
b96ca6 |
- EXTERN linenr_T write_no_eol_lnum INIT(= 0); /* non-zero lnum when last line
|
|
Karsten Hopp |
b96ca6 |
- of next binary write should
|
|
Karsten Hopp |
b96ca6 |
- not have an end-of-line */
|
|
Karsten Hopp |
b96ca6 |
-
|
|
Karsten Hopp |
b96ca6 |
#ifdef FEAT_WINDOWS
|
|
Karsten Hopp |
b96ca6 |
EXTERN int postponed_split INIT(= 0); /* for CTRL-W CTRL-] command */
|
|
Karsten Hopp |
b96ca6 |
EXTERN int postponed_split_flags INIT(= 0); /* args for win_split() */
|
|
Karsten Hopp |
b96ca6 |
--- 1057,1062 ----
|
|
Karsten Hopp |
b96ca6 |
*** ../vim-7.3.123/src/os_unix.c 2011-02-09 18:47:36.000000000 +0100
|
|
Karsten Hopp |
b96ca6 |
--- src/os_unix.c 2011-02-15 17:07:22.000000000 +0100
|
|
Karsten Hopp |
b96ca6 |
***************
|
|
Karsten Hopp |
b96ca6 |
*** 4245,4251 ****
|
|
Karsten Hopp |
b96ca6 |
* should not have one. */
|
|
Karsten Hopp |
b96ca6 |
if (lnum != curbuf->b_op_end.lnum
|
|
Karsten Hopp |
b96ca6 |
|| !curbuf->b_p_bin
|
|
Karsten Hopp |
b96ca6 |
! || (lnum != write_no_eol_lnum
|
|
Karsten Hopp |
b96ca6 |
&& (lnum !=
|
|
Karsten Hopp |
b96ca6 |
curbuf->b_ml.ml_line_count
|
|
Karsten Hopp |
b96ca6 |
|| curbuf->b_p_eol)))
|
|
Karsten Hopp |
b96ca6 |
--- 4245,4251 ----
|
|
Karsten Hopp |
b96ca6 |
* should not have one. */
|
|
Karsten Hopp |
b96ca6 |
if (lnum != curbuf->b_op_end.lnum
|
|
Karsten Hopp |
b96ca6 |
|| !curbuf->b_p_bin
|
|
Karsten Hopp |
b96ca6 |
! || (lnum != curbuf->b_no_eol_lnum
|
|
Karsten Hopp |
b96ca6 |
&& (lnum !=
|
|
Karsten Hopp |
b96ca6 |
curbuf->b_ml.ml_line_count
|
|
Karsten Hopp |
b96ca6 |
|| curbuf->b_p_eol)))
|
|
Karsten Hopp |
b96ca6 |
***************
|
|
Karsten Hopp |
b96ca6 |
*** 4588,4597 ****
|
|
Karsten Hopp |
b96ca6 |
{
|
|
Karsten Hopp |
b96ca6 |
append_ga_line(&ga);
|
|
Karsten Hopp |
b96ca6 |
/* remember that the NL was missing */
|
|
Karsten Hopp |
b96ca6 |
! write_no_eol_lnum = curwin->w_cursor.lnum;
|
|
Karsten Hopp |
b96ca6 |
}
|
|
Karsten Hopp |
b96ca6 |
else
|
|
Karsten Hopp |
b96ca6 |
! write_no_eol_lnum = 0;
|
|
Karsten Hopp |
b96ca6 |
ga_clear(&ga);
|
|
Karsten Hopp |
b96ca6 |
}
|
|
Karsten Hopp |
b96ca6 |
|
|
Karsten Hopp |
b96ca6 |
--- 4588,4597 ----
|
|
Karsten Hopp |
b96ca6 |
{
|
|
Karsten Hopp |
b96ca6 |
append_ga_line(&ga);
|
|
Karsten Hopp |
b96ca6 |
/* remember that the NL was missing */
|
|
Karsten Hopp |
b96ca6 |
! curbuf->b_no_eol_lnum = curwin->w_cursor.lnum;
|
|
Karsten Hopp |
b96ca6 |
}
|
|
Karsten Hopp |
b96ca6 |
else
|
|
Karsten Hopp |
b96ca6 |
! curbuf->b_no_eol_lnum = 0;
|
|
Karsten Hopp |
b96ca6 |
ga_clear(&ga);
|
|
Karsten Hopp |
b96ca6 |
}
|
|
Karsten Hopp |
b96ca6 |
|
|
Karsten Hopp |
b96ca6 |
*** ../vim-7.3.123/src/version.c 2011-02-15 16:29:54.000000000 +0100
|
|
Karsten Hopp |
b96ca6 |
--- src/version.c 2011-02-15 17:37:38.000000000 +0100
|
|
Karsten Hopp |
b96ca6 |
***************
|
|
Karsten Hopp |
b96ca6 |
*** 716,717 ****
|
|
Karsten Hopp |
b96ca6 |
--- 716,719 ----
|
|
Karsten Hopp |
b96ca6 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
b96ca6 |
+ /**/
|
|
Karsten Hopp |
b96ca6 |
+ 124,
|
|
Karsten Hopp |
b96ca6 |
/**/
|
|
Karsten Hopp |
b96ca6 |
|
|
Karsten Hopp |
b96ca6 |
--
|
|
Karsten Hopp |
b96ca6 |
hundred-and-one symptoms of being an internet addict:
|
|
Karsten Hopp |
b96ca6 |
270. You are subscribed to a mailing list for every piece of software
|
|
Karsten Hopp |
b96ca6 |
you use.
|
|
Karsten Hopp |
b96ca6 |
|
|
Karsten Hopp |
b96ca6 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
b96ca6 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
b96ca6 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
b96ca6 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|