diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2015-05-25 16:30:17 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2015-05-25 16:30:17 -0400 |
commit | a7b5ae37a71dae93f86da3003bf267fc4f4490f0 (patch) | |
tree | e9b0aba5a26f1cf543ba266aabd9edb0911d7c54 /src | |
parent | 297973ab00155048a627e8bf72ff4b14d71a6a01 (diff) | |
parent | e4c3ac1f82ea69777e1dcbfeb18a42c572c54d8f (diff) | |
download | rneovim-a7b5ae37a71dae93f86da3003bf267fc4f4490f0.tar.gz rneovim-a7b5ae37a71dae93f86da3003bf267fc4f4490f0.tar.bz2 rneovim-a7b5ae37a71dae93f86da3003bf267fc4f4490f0.zip |
Merge #2555 Remove "j" flag from 'cpoptions'
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/edit.c | 7 | ||||
-rw-r--r-- | src/nvim/ops.c | 8 | ||||
-rw-r--r-- | src/nvim/option_defs.h | 5 | ||||
-rw-r--r-- | src/nvim/search.c | 6 | ||||
-rw-r--r-- | src/nvim/testdir/Makefile | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test29.in | 229 | ||||
-rw-r--r-- | src/nvim/testdir/test29.ok | 97 |
7 files changed, 12 insertions, 342 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 31a5c54c20..9704295aaa 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -3719,11 +3719,10 @@ static int ins_compl_get_exp(pos_T *ini) /* IObuf =~ "\k.* ", thus len >= 2 */ if (p_js && (IObuff[len - 2] == '.' - || (vim_strchr(p_cpo, CPO_JOINSP) - == NULL - && (IObuff[len - 2] == '?' - || IObuff[len - 2] == '!')))) + || IObuff[len - 2] == '?' + || IObuff[len - 2] == '!')) { IObuff[len++] = ' '; + } } /* copy as much as possible of the new word */ if (tmp_ptr - ptr >= IOSIZE - len) diff --git a/src/nvim/ops.c b/src/nvim/ops.c index dfc41d5685..0b95dd4642 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -3460,12 +3460,10 @@ int do_join(long count, endcurr1 = endcurr2; else ++spaces[t]; - /* extra space when 'joinspaces' set and line ends in '.' */ - if ( p_js - && (endcurr1 == '.' - || (vim_strchr(p_cpo, CPO_JOINSP) == NULL - && (endcurr1 == '?' || endcurr1 == '!')))) + // Extra space when 'joinspaces' set and line ends in '.', '?', or '!'. + if (p_js && (endcurr1 == '.' || endcurr1 == '?' || endcurr1 == '!')) { ++spaces[t]; + } } } currsize = (int)STRLEN(curr); diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index de8816af0a..80f2373a85 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -97,7 +97,6 @@ #define CPO_FNAMEW 'F' /* set file name for ":w file" */ #define CPO_INTMOD 'i' /* interrupt a read makes buffer modified */ #define CPO_INDENT 'I' /* remove auto-indent more often */ -#define CPO_JOINSP 'j' /* only use two spaces for join after '.' */ #define CPO_ENDOFSENT 'J' /* need two spaces to detect end of sentence */ #define CPO_KEYCODE 'k' /* don't recognize raw key code in mappings */ #define CPO_KOFFSET 'K' /* don't wait for key code in mappings */ @@ -141,9 +140,9 @@ * cursor would not move */ /* default values for Vim, Vi and POSIX */ #define CPO_VIM "aABceFs" -#define CPO_VI "aAbBcCdDeEfFiIjJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>;" +#define CPO_VI "aAbBcCdDeEfFiIJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>;" #define CPO_ALL \ - "aAbBcCdDeEfFiIjJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>#{|&/\\.;" + "aAbBcCdDeEfFiIJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>#{|&/\\.;" /* characters for p_ww option: */ #define WW_ALL "bshl<>[],~" diff --git a/src/nvim/search.c b/src/nvim/search.c index 464e112900..e10504973b 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -4335,10 +4335,10 @@ search_line: /* IObuf =~ "\(\k\|\i\).* ", thus i >= 2*/ if (p_js && (IObuff[i-2] == '.' - || (vim_strchr(p_cpo, CPO_JOINSP) == NULL - && (IObuff[i-2] == '?' - || IObuff[i-2] == '!')))) + || IObuff[i-2] == '?' + || IObuff[i-2] == '!')) { IObuff[i++] = ' '; + } } /* copy as much as possible of the new word */ if (p - aux >= IOSIZE - i) diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 6ff3763fd4..f22cb79748 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -14,7 +14,7 @@ SCRIPTS := test_autoformat_join.out \ test11.out test12.out test13.out test14.out \ test17.out \ test24.out \ - test26.out test27.out test29.out test30.out \ + test26.out test27.out test30.out \ test32.out test34.out \ test36.out test37.out test39.out test40.out \ test42.out test43.out test45.out \ diff --git a/src/nvim/testdir/test29.in b/src/nvim/testdir/test29.in deleted file mode 100644 index 4cc2120814..0000000000 --- a/src/nvim/testdir/test29.in +++ /dev/null @@ -1,229 +0,0 @@ -Test for joining lines and marks in them - in compatible and nocompatible modes - and with 'joinspaces' set or not - and with 'cpoptions' flag 'j' set or not - -STARTTEST -:so small.vim -:set nojoinspaces -:set cpoptions-=j -/firstline/ -j"td/^STARTTEST/-1 -PJjJjJjJjJjJjJjJjJjJjJjJjJjJj05lmx2j06lmy2k4Jy3l$p`xyl$p`yy2l$p:set cpoptions+=j -j05lmx2j06lmy2k4Jy3l$p`xyl$p`yy2l$p:set cpoptions-=j joinspaces -j"tpJjJjJjJjJjJjJjJjJjJjJjJjJjJj05lmx2j06lmy2k4Jy3l$p`xyl$p`yy2l$p:set cpoptions+=j -j05lmx2j06lmy2k4Jy3l$p`xyl$p`yy2l$p:set cpo+=qo -j"tpJjJjJjJjJjJjJjJjJjJjJjJjJjJj4Jy3l$pjd/STARTTEST/-2 -ENDTEST - -firstline -asdfasdf. -asdf -asdfasdf. -asdf -asdfasdf. -asdf -asdfasdf. -asdf -asdfasdf. -asdf -asdfasdf. -asdf -asdfasdf. -asdf -asdfasdf -asdf -asdfasdf -asdf -asdfasdf -asdf -asdfasdf -asdf -asdfasdf -asdf -asdfasdf -asdf -asdfasdf -asdf -zx cvn. -as dfg? -hjkl iop! -ert -zx cvn. -as dfg? -hjkl iop! -ert - -STARTTEST -/^{/+1 -:set comments=s1:/*,mb:*,ex:*/,:// -:set nojoinspaces fo=j -:set backspace=eol,start -:.,+3join -j4J -:.,+2join -j3J -:.,+2join -j3J -:.,+2join -jj3J -ENDTEST - -{ - -/* - * Make sure the previous comment leader is not removed. - */ - -/* - * Make sure the previous comment leader is not removed. - */ - -// Should the next comment leader be left alone? -// Yes. - -// Should the next comment leader be left alone? -// Yes. - -/* Here the comment leader should be left intact. */ -// And so should this one. - -/* Here the comment leader should be left intact. */ -// And so should this one. - -if (condition) // Remove the next comment leader! - // OK, I will. - action(); - -if (condition) // Remove the next comment leader! - // OK, I will. - action(); -} - -STARTTEST -:" Test with backspace set to the non-compatible setting -/^\d\+ this -:set bs=2 -Avim1 -Avim2u -:set cpo-=< -:inoremap <c-u> <left><c-u> -Avim3 -:iunmap <c-u> -Avim4 -:" Test with backspace set to the compatible setting -:set bs= -A vim5A -A vim6Azweiu -:inoremap <c-u> <left><c-u> -A vim7 -:set noesckeys -ENDTEST -1 this shouldn't be deleted -2 this shouldn't be deleted -3 this shouldn't be deleted -4 this should be deleted -5 this shouldn't be deleted -6 this shouldn't be deleted -7 this shouldn't be deleted -8 this shouldn't be deleted (not touched yet) - -STARTTEST -/^{/+1 -:set comments=sO:*\ -,mO:*\ \ ,exO:*/ -:set comments+=s1:/*,mb:*,ex:*/,:// -:set comments+=s1:>#,mb:#,ex:#<,:< -:set cpoptions-=j joinspaces fo=j -:set backspace=eol,start -:.,+3join -j4J -:.,+8join -j9J -:.,+2join -j3J -:.,+2join -j3J -:.,+2join -jj3J -j:.,+2join -jj3J -j:.,+5join -j6J -oSome code!
// Make sure backspacing does not remove this comment leader.0i -ENDTEST - -{ - -/* - * Make sure the previous comment leader is not removed. - */ - -/* - * Make sure the previous comment leader is not removed. - */ - -/* List: - * - item1 - * foo bar baz - * foo bar baz - * - item2 - * foo bar baz - * foo bar baz - */ - -/* List: - * - item1 - * foo bar baz - * foo bar baz - * - item2 - * foo bar baz - * foo bar baz - */ - -// Should the next comment leader be left alone? -// Yes. - -// Should the next comment leader be left alone? -// Yes. - -/* Here the comment leader should be left intact. */ -// And so should this one. - -/* Here the comment leader should be left intact. */ -// And so should this one. - -if (condition) // Remove the next comment leader! - // OK, I will. - action(); - -if (condition) // Remove the next comment leader! - // OK, I will. - action(); - -int i = 7 /* foo *// 3 - // comment - ; - -int i = 7 /* foo *// 3 - // comment - ; - -># Note that the last character of the ending comment leader (left angle - # bracket) is a comment leader itself. Make sure that this comment leader is - # not removed from the next line #< -< On this line a new comment is opened which spans 2 lines. This comment should -< retain its comment leader. - -># Note that the last character of the ending comment leader (left angle - # bracket) is a comment leader itself. Make sure that this comment leader is - # not removed from the next line #< -< On this line a new comment is opened which spans 2 lines. This comment should -< retain its comment leader. - -} - -STARTTEST -:g/^STARTTEST/.,/^ENDTEST/d -:?firstline?+1,$w! test.out -:qa! -ENDTEST diff --git a/src/nvim/testdir/test29.ok b/src/nvim/testdir/test29.ok deleted file mode 100644 index 9dc07ed46b..0000000000 --- a/src/nvim/testdir/test29.ok +++ /dev/null @@ -1,97 +0,0 @@ -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -zx cvn. as dfg? hjkl iop! ert ernop -zx cvn. as dfg? hjkl iop! ert ernop - -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -zx cvn. as dfg? hjkl iop! ert enop -zx cvn. as dfg? hjkl iop! ert ernop - -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -zx cvn. as dfg? hjkl iop! ert a - - -{ -/* Make sure the previous comment leader is not removed. */ -/* Make sure the previous comment leader is not removed. */ -// Should the next comment leader be left alone? Yes. -// Should the next comment leader be left alone? Yes. -/* Here the comment leader should be left intact. */ // And so should this one. -/* Here the comment leader should be left intact. */ // And so should this one. -if (condition) // Remove the next comment leader! OK, I will. - action(); -if (condition) // Remove the next comment leader! OK, I will. - action(); -} - -1 this shouldn't be deleted -2 this shouldn't be deleted -3 this shouldn't be deleted -4 this should be deleted3 - -6 this shouldn't be deleted vim5 -7 this shouldn't be deleted vim6 -8 this shouldn't be deleted (not touched yet) vim7 - - -{ -/* Make sure the previous comment leader is not removed. */ -/* Make sure the previous comment leader is not removed. */ -/* List: item1 foo bar baz foo bar baz item2 foo bar baz foo bar baz */ -/* List: item1 foo bar baz foo bar baz item2 foo bar baz foo bar baz */ -// Should the next comment leader be left alone? Yes. -// Should the next comment leader be left alone? Yes. -/* Here the comment leader should be left intact. */ // And so should this one. -/* Here the comment leader should be left intact. */ // And so should this one. -if (condition) // Remove the next comment leader! OK, I will. - action(); -if (condition) // Remove the next comment leader! OK, I will. - action(); -int i = 7 /* foo *// 3 // comment - ; -int i = 7 /* foo *// 3 // comment - ; -># Note that the last character of the ending comment leader (left angle bracket) is a comment leader itself. Make sure that this comment leader is not removed from the next line #< < On this line a new comment is opened which spans 2 lines. This comment should retain its comment leader. -># Note that the last character of the ending comment leader (left angle bracket) is a comment leader itself. Make sure that this comment leader is not removed from the next line #< < On this line a new comment is opened which spans 2 lines. This comment should retain its comment leader. - -Some code!// Make sure backspacing does not remove this comment leader. -} - |