diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 2e2611692c..7a0487bb64 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -8360,10 +8360,10 @@ static bool ins_tab(void) static bool ins_eol(int c) { if (echeck_abbr(c + ABBR_OFF)) { - return false; + return true; } if (stop_arrow() == FAIL) { - return true; + return false; } undisplay_dollar(); diff --git a/src/nvim/testdir/test_mapping.vim b/src/nvim/testdir/test_mapping.vim index 071b8b369b..247c01c98d 100644 --- a/src/nvim/testdir/test_mapping.vim +++ b/src/nvim/testdir/test_mapping.vim @@ -214,3 +214,19 @@ func Test_cabbr_visual_mode() call assert_equal(expected, getreg(':')) cunabbr s endfunc + +func Test_abbreviation_CR() + new + func Eatchar(pat) + let c = nr2char(getchar(0)) + return (c =~ a:pat) ? '' : c + endfunc + iabbrev ~~7 =repeat('~', 7)=Eatchar('\s') + call feedkeys("GA~~7 \", 'xt') + call assert_equal('~~~~~~~', getline('$')) + %d + call feedkeys("GA~~7\\", 'xt') + call assert_equal(['~~~~~~~', ''], getline(1,'$')) + delfunc Eatchar + bw! +endfunc