aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <janedmundlazo@hotmail.com>2018-11-01 22:51:40 -0400
committerJan Edmund Lazo <janedmundlazo@hotmail.com>2018-11-01 23:20:06 -0400
commita9b7debbbc7c0190324523710ea7e6ed6070222c (patch)
tree26182af1783205264b98222457a5cf1abc375576
parent44c111e49f4c7c015bf66855fd6f2f69f1e02c07 (diff)
downloadrneovim-a9b7debbbc7c0190324523710ea7e6ed6070222c.tar.gz
rneovim-a9b7debbbc7c0190324523710ea7e6ed6070222c.tar.bz2
rneovim-a9b7debbbc7c0190324523710ea7e6ed6070222c.zip
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
-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