From a9b7debbbc7c0190324523710ea7e6ed6070222c Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 1 Nov 2018 22:51:40 -0400 Subject: vim-patch:8.0.1766: expanding abbreviation doesn't work Problem: Expanding abbreviation doesn't work. (Tooth Pik) Solution: Return OK instead of FALSE and FAIL instead of TRUE. (Christian Brabandt) https://github.com/vim/vim/commit/c3c3e698966fac86dee94799b70947defb85440d --- src/nvim/edit.c | 4 ++-- src/nvim/testdir/test_mapping.vim | 16 ++++++++++++++++ 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 ~~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 -- cgit