diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-01-11 22:15:05 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-01-11 22:15:05 +0100 |
commit | c3c3158756ae074052b0db2a3e3a7ba192df5330 (patch) | |
tree | 79e1b820b5e86fce5f98573097e4457ec06f5881 /src/testdir/test_textformat.vim | |
parent | 44a7db4ffdd11dafd345fd1c2c7b2509d01e3895 (diff) |
patch 8.1.0728: cannot avoid breaking after a single space.v8.1.0728
Problem: Cannot avoid breaking after a single space.
Solution: Add the 'p' flag to 'formatoptions'. (Tom Ryder)
Diffstat (limited to 'src/testdir/test_textformat.vim')
-rw-r--r-- | src/testdir/test_textformat.vim | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/testdir/test_textformat.vim b/src/testdir/test_textformat.vim index 0f8e09532b..13fb50b985 100644 --- a/src/testdir/test_textformat.vim +++ b/src/testdir/test_textformat.vim @@ -163,6 +163,32 @@ func Test_text_format() \ '# 1 xxxxx', \ '# foobar'], getline(1, 2)) + " Test the 'p' flag for 'formatoptions' + " First test without the flag: that it will break "Mr. Feynman" at the space + normal ggdG + setl tw=28 fo=tcq + call setline('.', 'Surely you''re joking, Mr. Feynman!') + normal gqq + call assert_equal([ + \ 'Surely you''re joking, Mr.', + \ 'Feynman!'], getline(1, 2)) + " Now test with the flag: that it will push the name with the title onto the + " next line + normal ggdG + setl fo+=p + call setline('.', 'Surely you''re joking, Mr. Feynman!') + normal gqq + call assert_equal([ + \ 'Surely you''re joking,', + \ 'Mr. Feynman!'], getline(1, 2)) + " Ensure that it will still break if two spaces are entered + normal ggdG + call setline('.', 'Surely you''re joking, Mr. Feynman!') + normal gqq + call assert_equal([ + \ 'Surely you''re joking, Mr.', + \ 'Feynman!'], getline(1, 2)) + setl ai& tw& fo& si& comments& enew! endfunc |