{"action":"created","issue":{"url":"https://api.github.com/repos/neovim/neovim/issues/3443","labels_url":"https://api.github.com/repos/neovim/neovim/issues/3443/labels{/name}","comments_url":"https://api.github.com/repos/neovim/neovim/issues/3443/comments","events_url":"https://api.github.com/repos/neovim/neovim/issues/3443/events","html_url":"https://github.com/neovim/neovim/pull/3443","id":110758083,"number":3443,"title":"[RFC] vim-patch:7.4.{785,795,898}","user":{"login":"johanhelsing","id":2620557,"avatar_url":"https://avatars.githubusercontent.com/u/2620557?v=3","gravatar_id":"","url":"https://api.github.com/users/johanhelsing","html_url":"https://github.com/johanhelsing","followers_url":"https://api.github.com/users/johanhelsing/followers","following_url":"https://api.github.com/users/johanhelsing/following{/other_user}","gists_url":"https://api.github.com/users/johanhelsing/gists{/gist_id}","starred_url":"https://api.github.com/users/johanhelsing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johanhelsing/subscriptions","organizations_url":"https://api.github.com/users/johanhelsing/orgs","repos_url":"https://api.github.com/users/johanhelsing/repos","events_url":"https://api.github.com/users/johanhelsing/events{/privacy}","received_events_url":"https://api.github.com/users/johanhelsing/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/neovim/neovim/labels/RFC","name":"RFC","color":"dfdfdf"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-10-10T01:00:40Z","updated_at":"2015-11-08T09:06:17Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/neovim/neovim/pulls/3443","html_url":"https://github.com/neovim/neovim/pull/3443","diff_url":"https://github.com/neovim/neovim/pull/3443.diff","patch_url":"https://github.com/neovim/neovim/pull/3443.patch"},"body":"```\r\nProblem:    On some systems automatically adding the missing EOL causes\r\n            problems. Setting 'binary' has too many side effects.\r\nSolution:   Add the 'fixeol' option, default on. (Pavel Samarkin)\r\n```\r\n\r\nhttps://github.com/vim/vim/commit/34d72d4b6c1a2b04a214d8a49b7d22c97bc7a8bc\r\n\r\nOriginal patch:\r\n\r\n```diff\r\ncommit 34d72d4b6c1a2b04a214d8a49b7d22c97bc7a8bc\r\nAuthor: Bram Moolenaar <Bram@vim.org>\r\nDate:   Fri Jul 17 14:18:08 2015 +0200\r\n\r\n    patch 7.4.785\r\n    Problem:    On some systems automatically adding the missing EOL causes\r\n                problems. Setting 'binary' has too many side effects.\r\n    Solution:   Add the 'fixeol' option, default on. (Pavel Samarkin)\r\n\r\ndiff --git a/runtime/doc/options.txt b/runtime/doc/options.txt\r\nindex 209e1ba..3b3e104 100644\r\n--- a/runtime/doc/options.txt\r\n+++ b/runtime/doc/options.txt\r\n@@ -1,4 +1,4 @@\r\n-*options.txt*\tFor Vim version 7.4.  Last change: 2015 Jul 10\r\n+*options.txt*\tFor Vim version 7.4.  Last change: 2015 Jul 17\r\n \r\n \r\n \t\t  VIM REFERENCE MANUAL\t  by Bram Moolenaar\r\n@@ -2671,15 +2671,16 @@ A jump table for the options with a short description can be found at |Q_op|.\r\n \t\t\tlocal to buffer\r\n \t\t\t{not in Vi}\r\n \tWhen writing a file and this option is off and the 'binary' option\r\n-\tis on, no <EOL> will be written for the last line in the file.  This\r\n-\toption is automatically set when starting to edit a new file, unless\r\n-\tthe file does not have an <EOL> for the last line in the file, in\r\n-\twhich case it is reset.  Normally you don't have to set or reset this\r\n-\toption.  When 'binary' is off the value is not used when writing the\r\n-\tfile.  When 'binary' is on it is used to remember the presence of a\r\n-\t<EOL> for the last line in the file, so that when you write the file\r\n-\tthe situation from the original file can be kept.  But you can change\r\n-\tit if you want to.\r\n+\tis on, or 'fixeol' option is off, no <EOL> will be written for the\r\n+\tlast line in the file.  This option is automatically set or reset when\r\n+\tstarting to edit a new file, depending on whether file has an <EOL>\r\n+\tfor the last line in the file.  Normally you don't have to set or\r\n+\treset this option.\r\n+\tWhen 'binary' is off and 'fixeol' is on the value is not used when\r\n+\twriting the file.  When 'binary' is on or 'fixeol' is off it is used\r\n+\tto remember the presence of a <EOL> for the last line in the file, so\r\n+\tthat when you write the file the situation from the original file can\r\n+\tbe kept.  But you can change it if you want to.\r\n \r\n \t\t\t     *'equalalways'* *'ea'* *'noequalalways'* *'noea'*\r\n 'equalalways' 'ea'\tboolean\t(default on)\r\n@@ -3064,6 +3065,17 @@ A jump table for the options with a short description can be found at |Q_op|.\r\n \t  fold:c\tFolded\t\t\t|hl-Folded|\r\n \t  diff:c\tDiffDelete\t\t|hl-DiffDelete|\r\n \r\n+\t\t*'fixendofline'* *'fixeol'* *'nofixendofline'* *'nofixeol'*\r\n+'fixendofline' 'fixeol'\tboolean\t(default on)\r\n+\t\t\tlocal to buffer\r\n+\t\t\t{not in Vi}\r\n+\tWhen writing a file and this option is on, <EOL> at the end of file\r\n+\twill be restored if missing. Turn this option off if you want to\r\n+\tpreserve the situation from the original file.\r\n+\tWhen the 'binary' option is set the value of this option doesn't\r\n+\tmatter.\r\n+\tSee the 'endofline' option.\r\n+\r\n \t\t\t\t\t*'fkmap'* *'fk'* *'nofkmap'* *'nofk'*\r\n 'fkmap' 'fk'\t\tboolean (default off)\t\t\t*E198*\r\n \t\t\tglobal\r\ndiff --git a/runtime/optwin.vim b/runtime/optwin.vim\r\nindex 55353ce..921ae36 100644\r\n--- a/runtime/optwin.vim\r\n+++ b/runtime/optwin.vim\r\n@@ -954,6 +954,9 @@ call <SID>BinOptionL(\"bin\")\r\n call append(\"$\", \"endofline\\tlast line in the file has an end-of-line\")\r\n call append(\"$\", \"\\t(local to buffer)\")\r\n call <SID>BinOptionL(\"eol\")\r\n+call append(\"$\", \"fixeol\\tfixes missing end-of-line at end of text file\")\r\n+call append(\"$\", \"\\t(local to buffer)\")\r\n+call <SID>BinOptionL(\"fixeol\")\r\n if has(\"multi_byte\")\r\n   call append(\"$\", \"bomb\\tprepend a Byte Order Mark to the file\")\r\n   call append(\"$\", \"\\t(local to buffer)\")\r\ndiff --git a/src/nvim/buffer.c b/src/nvim/buffer.c\r\nindex 97c6596..c4d5e34 100644\r\n--- a/src/nvim/buffer.c\r\n+++ b/src/nvim/buffer.c\r\n@@ -547,6 +547,7 @@ buf_clear_file(buf)\r\n     buf->b_shortname = FALSE;\r\n #endif\r\n     buf->b_p_eol = TRUE;\r\n+    buf->b_p_fixeol = TRUE;\r\n     buf->b_start_eol = TRUE;\r\n #ifdef FEAT_MBYTE\r\n     buf->b_p_bomb = FALSE;\r\ndiff --git a/src/nvim/fileio.c b/src/nvim/fileio.c\r\nindex 9965920..fb14dbf 100644\r\n--- a/src/nvim/fileio.c\r\n+++ b/src/nvim/fileio.c\r\n@@ -2623,10 +2623,10 @@ failed:\r\n #endif\r\n \r\n     /*\r\n-     * Trick: We remember if the last line of the read didn't have\r\n-     * an eol even when 'binary' is off, for when writing it again with\r\n-     * 'binary' on.  This is required for\r\n-     * \":autocmd FileReadPost *.gz set bin|'[,']!gunzip\" to work.\r\n+     * We remember if the last line of the read didn't have\r\n+     * an eol even when 'binary' is off, to support turning 'fixeol' off,\r\n+     * or writing the read again with 'binary' on.  The latter is required\r\n+     * for \":autocmd FileReadPost *.gz set bin|'[,']!gunzip\" to work.\r\n      */\r\n     curbuf->b_no_eol_lnum = read_no_eol_lnum;\r\n \r\n@@ -4547,7 +4547,7 @@ restore_backup:\r\n \t/* write failed or last line has no EOL: stop here */\r\n \tif (end == 0\r\n \t\t|| (lnum == end\r\n-\t\t    && write_bin\r\n+\t\t    && (write_bin || !buf->b_p_fixeol)\r\n \t\t    && (lnum == buf->b_no_eol_lnum\r\n \t\t\t|| (lnum == buf->b_ml.ml_line_count && !buf->b_p_eol))))\r\n \t{\r\ndiff --git a/src/nvim/memline.c b/src/nvim/memline.c\r\nindex 91ef270..8cd9b80 100644\r\n--- a/src/nvim/memline.c\r\n+++ b/src/nvim/memline.c\r\n@@ -5361,8 +5361,10 @@ ml_find_line_or_offset(buf, lnum, offp)\r\n \tif (ffdos)\r\n \t    size += lnum - 1;\r\n \r\n-\t/* Don't count the last line break if 'bin' and 'noeol'. */\r\n-\tif (buf->b_p_bin && !buf->b_p_eol && buf->b_ml.ml_line_count == lnum)\r\n+\t/* Don't count the last line break if 'noeol' and ('bin' or\r\n+\t * 'nofixeol'). */\r\n+\tif ((!buf->b_p_fixeol || buf->b_p_bin) && !buf->b_p_eol\r\n+\t\t\t\t\t   && buf->b_ml.ml_line_count == lnum)\r\n \t    size -= ffdos + 1;\r\n     }\r\n \r\ndiff --git a/src/nvim/netbeans.c b/src/nvim/netbeans.c\r\nindex 68ca301..ea0c017 100644\r\n--- a/src/nvim/netbeans.c\r\n+++ b/src/nvim/netbeans.c\r\n@@ -3802,7 +3802,7 @@ get_buf_size(buf_T *bufp)\r\n \t    }\r\n \t}\r\n \t/* Correction for when last line doesn't have an EOL. */\r\n-\tif (!bufp->b_p_eol && bufp->b_p_bin)\r\n+\tif (!bufp->b_p_eol && (bufp->b_p_bin || !bufp->b_p_fixeol))\r\n \t    char_count -= eol_size;\r\n     }\r\n \r\ndiff --git a/src/nvim/ops.c b/src/nvim/ops.c\r\nindex 7ad8222..3441f05 100644\r\n--- a/src/nvim/ops.c\r\n+++ b/src/nvim/ops.c\r\n@@ -7052,7 +7052,7 @@ cursor_pos_info()\r\n \t\t\t\t\t   &char_count_cursor, len, eol_size);\r\n \t\t    if (lnum == curbuf->b_ml.ml_line_count\r\n \t\t\t    && !curbuf->b_p_eol\r\n-\t\t\t    && curbuf->b_p_bin\r\n+\t\t\t    && (curbuf->b_p_bin || !curbuf->b_p_fixeol)\r\n \t\t\t    && (long)STRLEN(s) < len)\r\n \t\t\tbyte_count_cursor -= eol_size;\r\n \t\t}\r\n@@ -7076,7 +7076,7 @@ cursor_pos_info()\r\n \t}\r\n \r\n \t/* Correction for when last line doesn't have an EOL. */\r\n-\tif (!curbuf->b_p_eol && curbuf->b_p_bin)\r\n+\tif (!curbuf->b_p_eol && (curbuf->b_p_bin || !curbuf->b_p_fixeol))\r\n \t    byte_count -= eol_size;\r\n \r\n \tif (VIsual_active)\r\ndiff --git a/src/nvim/option.c b/src/nvim/option.c\r\nindex 2e805d7..40dcc8d 100644\r\n--- a/src/nvim/option.c\r\n+++ b/src/nvim/option.c\r\n@@ -98,6 +98,7 @@\r\n # define PV_INC\t\tOPT_BOTH(OPT_BUF(BV_INC))\r\n #endif\r\n #define PV_EOL\t\tOPT_BUF(BV_EOL)\r\n+#define PV_FIXEOL\tOPT_BUF(BV_FIXEOL)\r\n #define PV_EP\t\tOPT_BOTH(OPT_BUF(BV_EP))\r\n #define PV_ET\t\tOPT_BUF(BV_ET)\r\n #ifdef FEAT_MBYTE\r\n@@ -306,6 +307,7 @@ static char_u\t*p_cfu;\r\n static char_u\t*p_ofu;\r\n #endif\r\n static int\tp_eol;\r\n+static int\tp_fixeol;\r\n static int\tp_et;\r\n #ifdef FEAT_MBYTE\r\n static char_u\t*p_fenc;\r\n@@ -1169,6 +1171,9 @@ static struct vimoption\r\n \t\t\t    {(char_u *)\"\", (char_u *)0L}\r\n #endif\r\n \t\t\t    SCRIPTID_INIT},\r\n+    {\"fixendofline\",  \"fixeol\", P_BOOL|P_VI_DEF|P_RSTAT,\r\n+\t\t\t    (char_u *)&p_fixeol, PV_FIXEOL,\r\n+\t\t\t    {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT},\r\n     {\"fkmap\",\t    \"fk\",   P_BOOL|P_VI_DEF,\r\n #ifdef FEAT_FKMAP\r\n \t\t\t    (char_u *)&p_fkmap, PV_NONE,\r\n@@ -7781,6 +7786,11 @@ set_bool_option(opt_idx, varp, value, opt_flags)\r\n     {\r\n \tredraw_titles();\r\n     }\r\n+    /* when 'fixeol' is changed, redraw the window title */\r\n+    else if ((int *)varp == &curbuf->b_p_fixeol)\r\n+    {\r\n+\tredraw_titles();\r\n+    }\r\n # ifdef FEAT_MBYTE\r\n     /* when 'bomb' is changed, redraw the window title and tab page text */\r\n     else if ((int *)varp == &curbuf->b_p_bomb)\r\n@@ -10176,6 +10186,7 @@ get_varp(p)\r\n \tcase PV_OFU:\treturn (char_u *)&(curbuf->b_p_ofu);\r\n #endif\r\n \tcase PV_EOL:\treturn (char_u *)&(curbuf->b_p_eol);\r\n+\tcase PV_FIXEOL:\treturn (char_u *)&(curbuf->b_p_fixeol);\r\n \tcase PV_ET:\treturn (char_u *)&(curbuf->b_p_et);\r\n #ifdef FEAT_MBYTE\r\n \tcase PV_FENC:\treturn (char_u *)&(curbuf->b_p_fenc);\r\n@@ -11894,6 +11905,7 @@ save_file_ff(buf)\r\n  * from when editing started (save_file_ff() called).\r\n  * Also when 'endofline' was changed and 'binary' is set, or when 'bomb' was\r\n  * changed and 'binary' is not set.\r\n+ * Also when 'endofline' was changed and 'fixeol' is not set.\r\n  * When \"ignore_empty\" is true don't consider a new, empty buffer to be\r\n  * changed.\r\n  */\r\n@@ -11912,7 +11924,7 @@ file_ff_differs(buf, ignore_empty)\r\n \treturn FALSE;\r\n     if (buf->b_start_ffc != *buf->b_p_ff)\r\n \treturn TRUE;\r\n-    if (buf->b_p_bin && buf->b_start_eol != buf->b_p_eol)\r\n+    if ((buf->b_p_bin || !buf->b_p_fixeol) && buf->b_start_eol != buf->b_p_eol)\r\n \treturn TRUE;\r\n #ifdef FEAT_MBYTE\r\n     if (!buf->b_p_bin && buf->b_start_bomb != buf->b_p_bomb)\r\ndiff --git a/src/nvim/option.h b/src/nvim/option.h\r\nindex 7c7d35a..819473b 100644\r\n--- a/src/nvim/option.h\r\n+++ b/src/nvim/option.h\r\n@@ -962,6 +962,7 @@ enum\r\n     , BV_INC\r\n #endif\r\n     , BV_EOL\r\n+    , BV_FIXEOL\r\n     , BV_EP\r\n     , BV_ET\r\n     , BV_FENC\r\ndiff --git a/src/nvim/os_unix.c b/src/nvim/os_unix.c\r\nindex 57c013f..f53faa3 100644\r\n--- a/src/nvim/os_unix.c\r\n+++ b/src/nvim/os_unix.c\r\n@@ -4624,7 +4624,8 @@ mch_call_shell(cmd, options)\r\n \t\t\t\t/* Finished a line, add a NL, unless this line\r\n \t\t\t\t * should not have one. */\r\n \t\t\t\tif (lnum != curbuf->b_op_end.lnum\r\n-\t\t\t\t\t|| !curbuf->b_p_bin\r\n+\t\t\t\t\t|| (!curbuf->b_p_bin\r\n+\t\t\t\t\t    && curbuf->b_p_fixeol)\r\n \t\t\t\t\t|| (lnum != curbuf->b_no_eol_lnum\r\n \t\t\t\t\t    && (lnum !=\r\n \t\t\t\t\t\t    curbuf->b_ml.ml_line_count\r\ndiff --git a/src/nvim/os_win32.c b/src/nvim/os_win32.c\r\nindex b50ab95..1e1214b 100644\r\n--- a/src/nvim/os_win32.c\r\n+++ b/src/nvim/os_win32.c\r\n@@ -4173,7 +4173,8 @@ sub_process_writer(LPVOID param)\r\n \t    /* Finished a line, add a NL, unless this line should not have\r\n \t     * one. */\r\n \t    if (lnum != curbuf->b_op_end.lnum\r\n-\t\t|| !curbuf->b_p_bin\r\n+\t\t|| (!curbuf->b_p_bin\r\n+\t\t    && curbuf->b_p_fixeol)\r\n \t\t|| (lnum != curbuf->b_no_eol_lnum\r\n \t\t    && (lnum != curbuf->b_ml.ml_line_count\r\n \t\t\t|| curbuf->b_p_eol)))\r\ndiff --git a/src/nvim/structs.h b/src/nvim/structs.h\r\nindex fedd3b9..2c7f710 100644\r\n--- a/src/nvim/structs.h\r\n+++ b/src/nvim/structs.h\r\n@@ -635,7 +635,7 @@ typedef struct memline\r\n     int\t\tml_flags;\r\n \r\n     infoptr_T\t*ml_stack;\t/* stack of pointer blocks (array of IPTRs) */\r\n-    int\t\tml_stack_top;\t/* current top if ml_stack */\r\n+    int\t\tml_stack_top;\t/* current top of ml_stack */\r\n     int\t\tml_stack_size;\t/* total number of entries in ml_stack */\r\n \r\n     linenr_T\tml_line_lnum;\t/* line number of cached line, 0 if not valid */\r\n@@ -1586,6 +1586,7 @@ struct file_buffer\r\n     char_u\t*b_p_ofu;\t/* 'omnifunc' */\r\n #endif\r\n     int\t\tb_p_eol;\t/* 'endofline' */\r\n+    int\t\tb_p_fixeol;\t/* 'fixendofline' */\r\n     int\t\tb_p_et;\t\t/* 'expandtab' */\r\n     int\t\tb_p_et_nobin;\t/* b_p_et saved for binary mode */\r\n #ifdef FEAT_MBYTE\r\ndiff --git a/src/nvim/testdir/Make_amiga.mak b/src/nvim/testdir/Make_amiga.mak\r\nindex eba28f8..da47989 100644\r\n--- a/src/nvim/testdir/Make_amiga.mak\r\n+++ b/src/nvim/testdir/Make_amiga.mak\r\n@@ -45,6 +45,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \\\r\n \t\ttest_command_count.out \\\r\n \t\ttest_erasebackword.out \\\r\n \t\ttest_eval.out \\\r\n+\t\ttest_fixeol.out \\\r\n \t\ttest_increment.out \\\r\n \t\ttest_insertcount.out \\\r\n \t\ttest_listchars.out \\\r\n@@ -195,6 +196,7 @@ test_command_count.out: test_command_count.in\r\n test_erasebackword.out: test_erasebackword.in\r\n test_eval.out: test_eval.in\r\n test_increment.out: test_increment.in\r\n+test_fixeol.out: test_fixeol.in\r\n test_insertcount.out: test_insertcount.in\r\n test_listchars.out: test_listchars.in\r\n test_listlbr.out: test_listlbr.in\r\ndiff --git a/src/nvim/testdir/Make_dos.mak b/src/nvim/testdir/Make_dos.mak\r\nindex eecb735..6bb0577 100644\r\n--- a/src/nvim/testdir/Make_dos.mak\r\n+++ b/src/nvim/testdir/Make_dos.mak\r\n@@ -44,6 +44,7 @@ SCRIPTS =\ttest3.out test4.out test5.out test6.out test7.out \\\r\n \t\ttest_command_count.out \\\r\n \t\ttest_erasebackword.out \\\r\n \t\ttest_eval.out \\\r\n+\t\ttest_fixeol.out \\\r\n \t\ttest_increment.out \\\r\n \t\ttest_insertcount.out \\\r\n \t\ttest_listchars.out \\\r\ndiff --git a/src/nvim/testdir/Make_ming.mak b/src/nvim/testdir/Make_ming.mak\r\nindex 29d931d..faa2294 100644\r\n--- a/src/nvim/testdir/Make_ming.mak\r\n+++ b/src/nvim/testdir/Make_ming.mak\r\n@@ -66,6 +66,7 @@ SCRIPTS =\ttest3.out test4.out test5.out test6.out test7.out \\\r\n \t\ttest_command_count.out \\\r\n \t\ttest_erasebackword.out \\\r\n \t\ttest_eval.out \\\r\n+\t\ttest_fixeol.out \\\r\n \t\ttest_increment.out \\\r\n \t\ttest_insertcount.out \\\r\n \t\ttest_listchars.out \\\r\ndiff --git a/src/nvim/testdir/Make_os2.mak b/src/nvim/testdir/Make_os2.mak\r\nindex f473d89..b93408c 100644\r\n--- a/src/nvim/testdir/Make_os2.mak\r\n+++ b/src/nvim/testdir/Make_os2.mak\r\n@@ -46,6 +46,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \\\r\n \t\ttest_command_count.out \\\r\n \t\ttest_erasebackword.out \\\r\n \t\ttest_eval.out \\\r\n+\t\ttest_fixeol.out \\\r\n \t\ttest_increment.out \\\r\n \t\ttest_insertcount.out \\\r\n \t\ttest_listchars.out \\\r\ndiff --git a/src/nvim/testdir/Make_vms.mms b/src/nvim/testdir/Make_vms.mms\r\nindex 437f9b1..1c6a56d 100644\r\n--- a/src/nvim/testdir/Make_vms.mms\r\n+++ b/src/nvim/testdir/Make_vms.mms\r\n@@ -4,7 +4,7 @@\r\n # Authors:\tZoltan Arpadffy, <arpadffy@polarhome.com>\r\n #\t\tSandor Kopanyi,  <sandor.kopanyi@mailbox.hu>\r\n #\r\n-# Last change:  2015 Jul 10\r\n+# Last change:  2015 Jul 17\r\n #\r\n # This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.\r\n # Edit the lines in the Configuration section below to select.\r\n@@ -105,6 +105,7 @@ SCRIPT = test1.out  test2.out  test3.out  test4.out  test5.out  \\\r\n \t test_command_count.out \\\r\n \t test_erasebackword.out \\\r\n \t test_eval.out \\\r\n+\t test_fixeol.out \\\r\n \t test_increment.out \\\r\n \t test_insertcount.out \\\r\n \t test_listchars.out \\\r\ndiff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile\r\nindex 656a744..1a3ff85 100644\r\n--- a/src/nvim/testdir/Makefile\r\n+++ b/src/nvim/testdir/Makefile\r\n@@ -42,6 +42,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \\\r\n \t\ttest_command_count.out \\\r\n \t\ttest_erasebackword.out \\\r\n \t\ttest_eval.out \\\r\n+\t\ttest_fixeol.out \\\r\n \t\ttest_increment.out \\\r\n \t\ttest_insertcount.out \\\r\n \t\ttest_listchars.out \\\r\ndiff --git a/src/nvim/testdir/test_fixeol.in b/src/nvim/testdir/test_fixeol.in\r\nnew file mode 100644\r\nindex 0000000..a881fb1\r\n--- /dev/null\r\n+++ b/src/nvim/testdir/test_fixeol.in\r\n@@ -0,0 +1,40 @@\r\n+Tests for 'fixeol'                         vim: set ft=vim :\r\n+ \r\n+STARTTEST\r\n+:\" first write two test files – with and without trailing EOL\r\n+:\" use Unix fileformat for consistency\r\n+:set ff=unix\r\n+:enew!\r\n+awith eol\u001B:w! XXEol\r\n+:enew!\r\n+:set noeol nofixeol\r\n+awithout eol\u001B:w! XXNoEol\r\n+:set eol fixeol\r\n+:bwipe XXEol XXNoEol\r\n+:\"\r\n+:\" try editing files with 'fixeol' disabled\r\n+:e! XXEol\r\n+ostays eol\u001B:set nofixeol\r\n+:w! XXTestEol\r\n+:e! XXNoEol\r\n+ostays without\u001B:set nofixeol\r\n+:w! XXTestNoEol\r\n+:bwipe XXEol XXNoEol XXTestEol XXTestNoEol\r\n+:set fixeol\r\n+:\"\r\n+:\" Append \"END\" to each file so that we can see what the last written char was.\r\n+ggdGaEND\u001B:w >>XXEol\r\n+:w >>XXNoEol\r\n+:w >>XXTestEol\r\n+:w >>XXTestNoEol\r\n+:\"\r\n+:\" Concatenate the results\r\n+:e! test.out\r\n+a0\u001B:$r XXEol\r\n+:$r XXNoEol\r\n+Go1\u001B:$r XXTestEol\r\n+:$r XXTestNoEol\r\n+:w\r\n+:qa!\r\n+ENDTEST\r\n+\r\ndiff --git a/src/nvim/testdir/test_fixeol.ok b/src/nvim/testdir/test_fixeol.ok\r\nnew file mode 100644\r\nindex 0000000..68ac9be\r\n--- /dev/null\r\n+++ b/src/nvim/testdir/test_fixeol.ok\r\n@@ -0,0 +1,10 @@\r\n+0\r\n+with eol\r\n+END\r\n+without eolEND\r\n+1\r\n+with eol\r\n+stays eol\r\n+END\r\n+without eol\r\n+stays withoutEND\r\ndiff --git a/src/nvim/version.c b/src/nvim/version.c\r\nindex 4907d68..27a19ad 100644\r\n--- a/src/nvim/version.c\r\n+++ b/src/nvim/version.c\r\n@@ -742,6 +742,8 @@ static char *(features[]) =\r\n static int included_patches[] =\r\n {   /* Add new patch number below this line */\r\n /**/\r\n+    785,\r\n+/**/\r\n     784,\r\n /**/\r\n     783,\r\n```\r\n\r\n```\r\nProblem:    The 'fixeol' option is not copied to a new window.\r\nSolution:   Copy the option value. (Yasuhiro Matsumoto)\r\n```\r\n\r\nhttps://github.com/vim/vim/commit/b388be0abf04bba744f390587e8293bfbb1708a4\r\n\r\nOriginal patch:\r\n\r\n```diff\r\ncommit b388be0abf04bba744f390587e8293bfbb1708a4\r\nAuthor: Bram Moolenaar <Bram@vim.org>\r\nDate:   Wed Jul 22 22:19:38 2015 +0200\r\n\r\n    patch 7.4.795\r\n    Problem:    The 'fixeol' option is not copied to a new window.\r\n    Solution:   Copy the option value. (Yasuhiro Matsumoto)\r\n\r\ndiff --git a/src/nvim/option.c b/src/nvim/option.c\r\nindex b0f28d2..8e5021c 100644\r\n--- a/src/nvim/option.c\r\n+++ b/src/nvim/option.c\r\n@@ -10659,6 +10659,7 @@ buf_copy_options(buf, flags)\r\n #ifdef FEAT_MBYTE\r\n \t    buf->b_p_bomb = p_bomb;\r\n #endif\r\n+\t    buf->b_p_fixeol = p_fixeol;\r\n \t    buf->b_p_et = p_et;\r\n \t    buf->b_p_et_nobin = p_et_nobin;\r\n \t    buf->b_p_ml = p_ml;\r\ndiff --git a/src/nvim/version.c b/src/nvim/version.c\r\nindex a29c9fb..7cea9b1 100644\r\n--- a/src/nvim/version.c\r\n+++ b/src/nvim/version.c\r\n@@ -742,6 +742,8 @@ static char *(features[]) =\r\n static int included_patches[] =\r\n {   /* Add new patch number below this line */\r\n /**/\r\n+    795,\r\n+/**/\r\n     794,\r\n /**/\r\n     793,\r\n```\r\n\r\n\r\n```\r\nProblem:    The 'fixendofline' option is set on with \":edit\".\r\nSolution:   Don't set the option when clearing a buffer. (Yasuhiro Matsumoto)\r\n```\r\n\r\nhttps://github.com/vim/vim/commit/04dfd512293e951479aec2378753b946c39bea87\r\n\r\nOriginal patch:\r\n\r\n```diff\r\ncommit 04dfd512293e951479aec2378753b946c39bea87\r\nAuthor: Bram Moolenaar <Bram@vim.org>\r\nDate:   Tue Oct 13 20:55:50 2015 +0200\r\n\r\n    patch 7.4.898\r\n    Problem:    The 'fixendofline' option is set on with \":edit\".\r\n    Solution:   Don't set the option when clearing a buffer. (Yasuhiro Matsumoto)\r\n\r\ndiff --git a/src/nvim/buffer.c b/src/nvim/buffer.c\r\nindex 4623e0a..5d4170f 100644\r\n--- a/src/nvim/buffer.c\r\n+++ b/src/nvim/buffer.c\r\n@@ -547,7 +547,6 @@ buf_clear_file(buf)\r\n     buf->b_shortname = FALSE;\r\n #endif\r\n     buf->b_p_eol = TRUE;\r\n-    buf->b_p_fixeol = TRUE;\r\n     buf->b_start_eol = TRUE;\r\n #ifdef FEAT_MBYTE\r\n     buf->b_p_bomb = FALSE;\r\ndiff --git a/src/nvim/version.c b/src/nvim/version.c\r\nindex 71e1a2a..a2aec2c 100644\r\n--- a/src/nvim/version.c\r\n+++ b/src/nvim/version.c\r\n@@ -742,6 +742,8 @@ static char *(features[]) =\r\n static int included_patches[] =\r\n {   /* Add new patch number below this line */\r\n /**/\r\n+    898,\r\n+/**/\r\n     897,\r\n /**/\r\n     896,\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/neovim/neovim/issues/comments/154790371","html_url":"https://github.com/neovim/neovim/pull/3443#issuecomment-154790371","issue_url":"https://api.github.com/repos/neovim/neovim/issues/3443","id":154790371,"user":{"login":"johanhelsing","id":2620557,"avatar_url":"https://avatars.githubusercontent.com/u/2620557?v=3","gravatar_id":"","url":"https://api.github.com/users/johanhelsing","html_url":"https://github.com/johanhelsing","followers_url":"https://api.github.com/users/johanhelsing/followers","following_url":"https://api.github.com/users/johanhelsing/following{/other_user}","gists_url":"https://api.github.com/users/johanhelsing/gists{/gist_id}","starred_url":"https://api.github.com/users/johanhelsing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johanhelsing/subscriptions","organizations_url":"https://api.github.com/users/johanhelsing/orgs","repos_url":"https://api.github.com/users/johanhelsing/repos","events_url":"https://api.github.com/users/johanhelsing/events{/privacy}","received_events_url":"https://api.github.com/users/johanhelsing/received_events","type":"User","site_admin":false},"created_at":"2015-11-08T09:06:17Z","updated_at":"2015-11-08T09:06:17Z","body":"@justinmk did you get a chance to look at this?"}}