aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/edit.c4
-rw-r--r--src/nvim/testdir/test_mapping.vim16
2 files changed, 18 insertions, 2 deletions
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 <buffer><silent> ~~7 <c-r>=repeat('~', 7)<CR><c-r>=Eatchar('\s')<cr>
+ call feedkeys("GA~~7 \<esc>", 'xt')
+ call assert_equal('~~~~~~~', getline('$'))
+ %d
+ call feedkeys("GA~~7\<cr>\<esc>", 'xt')
+ call assert_equal(['~~~~~~~', ''], getline(1,'$'))
+ delfunc Eatchar
+ bw!
+endfunc