diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2022-11-02 08:02:52 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-02 08:02:52 +0800 |
| commit | 41f308feab35007534f0c213947701174d60c548 (patch) | |
| tree | 9447aef0ab181eba5731eb9c44c2773782d1ddec /src/nvim/testdir | |
| parent | b05d1943f063c382ea96b76d250877bc58297314 (diff) | |
| download | rneovim-41f308feab35007534f0c213947701174d60c548.tar.gz rneovim-41f308feab35007534f0c213947701174d60c548.tar.bz2 rneovim-41f308feab35007534f0c213947701174d60c548.zip | |
vim-patch:9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place (#20903)
Problem: If 'endofline' is set the CTRL-Z may be written in the wrong
place.
Solution: Write CTRL-Z at the end of the file. Update the help to explain
the possibilities better. (Ken Takata, closes vim/vim#11486)
https://github.com/vim/vim/commit/3af982196b1b973e953c35351961f2a96fe34172
Co-authored-by: K.Takata <kentkt@csc.jp>
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/test_fixeol.vim | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_fixeol.vim b/src/nvim/testdir/test_fixeol.vim index 9d6c900bdb..41d47d6a06 100644 --- a/src/nvim/testdir/test_fixeol.vim +++ b/src/nvim/testdir/test_fixeol.vim @@ -48,4 +48,71 @@ func Test_fixeol() enew! endfunc +func Test_eof() + let data = 0z68656c6c6f.0d0a.776f726c64 " "hello\r\nworld" + + " 1. Eol, Eof + " read + call writefile(data + 0z0d0a.1a, 'XXEolEof') + e! XXEolEof + call assert_equal(['hello', 'world'], getline(1, 2)) + call assert_equal([1, 1], [&eol, &eof]) + " write + set fixeol + w! + call assert_equal(data + 0z0d0a, readblob('XXEolEof')) + set nofixeol + w! + call assert_equal(data + 0z0d0a.1a, readblob('XXEolEof')) + + " 2. NoEol, Eof + " read + call writefile(data + 0z1a, 'XXNoEolEof') + e! XXNoEolEof + call assert_equal(['hello', 'world'], getline(1, 2)) + call assert_equal([0, 1], [&eol, &eof]) + " write + set fixeol + w! + call assert_equal(data + 0z0d0a, readblob('XXNoEolEof')) + set nofixeol + w! + call assert_equal(data + 0z1a, readblob('XXNoEolEof')) + + " 3. Eol, NoEof + " read + call writefile(data + 0z0d0a, 'XXEolNoEof') + e! XXEolNoEof + call assert_equal(['hello', 'world'], getline(1, 2)) + call assert_equal([1, 0], [&eol, &eof]) + " write + set fixeol + w! + call assert_equal(data + 0z0d0a, readblob('XXEolNoEof')) + set nofixeol + w! + call assert_equal(data + 0z0d0a, readblob('XXEolNoEof')) + + " 4. NoEol, NoEof + " read + call writefile(data, 'XXNoEolNoEof') + e! XXNoEolNoEof + call assert_equal(['hello', 'world'], getline(1, 2)) + call assert_equal([0, 0], [&eol, &eof]) + " write + set fixeol + w! + call assert_equal(data + 0z0d0a, readblob('XXNoEolNoEof')) + set nofixeol + w! + call assert_equal(data, readblob('XXNoEolNoEof')) + + call delete('XXEolEof') + call delete('XXNoEolEof') + call delete('XXEolNoEof') + call delete('XXNoEolNoEof') + set ff& fixeol& eof& eol& + enew! +endfunc + " vim: shiftwidth=2 sts=2 expandtab |