aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-03-15 07:14:42 -0400
committerJustin M. Keyes <justinkz@gmail.com>2019-03-15 12:14:42 +0100
commit680252aa15159f0e969f6d169d01a8fbad097fa4 (patch)
treea778b6677b7b23e33dfe25c2556ca818e220e8ec /src/nvim/testdir
parentced980ff17e18267e3d7a55fc1c513d967790e5e (diff)
downloadrneovim-680252aa15159f0e969f6d169d01a8fbad097fa4.tar.gz
rneovim-680252aa15159f0e969f6d169d01a8fbad097fa4.tar.bz2
rneovim-680252aa15159f0e969f6d169d01a8fbad097fa4.zip
vim-patch:8.1.0728: avoid breaking after single space #9733
Problem: Cannot avoid breaking after a single space. Solution: Add the 'p' flag to 'formatoptions'. (Tom Ryder) https://github.com/vim/vim/commit/c3c3158756ae074052b0db2a3e3a7ba192df5330
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_textformat.vim26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_textformat.vim b/src/nvim/testdir/test_textformat.vim
index 0f8e09532b..13fb50b985 100644
--- a/src/nvim/testdir/test_textformat.vim
+++ b/src/nvim/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