]> granicus.if.org Git - vim/commitdiff
patch 8.0.1766: expanding abbreviation doesn't work v8.0.1766
authorBram Moolenaar <Bram@vim.org>
Thu, 26 Apr 2018 20:30:33 +0000 (22:30 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 26 Apr 2018 20:30:33 +0000 (22:30 +0200)
Problem:    Expanding abbreviation doesn't work. (Tooth Pik)
Solution:   Return OK instead of FALSE and FAIL instead of TRUE. (Christian
            Brabandt)

src/edit.c
src/testdir/test_mapping.vim
src/version.c

index f29fbc79bea7da4d9c09721107469fcf5d90900a..eaf690ce9d49a6b0ad41604af8905a5deea87d7d 100644 (file)
@@ -10209,9 +10209,9 @@ ins_eol(int c)
     int            i;
 
     if (echeck_abbr(c + ABBR_OFF))
-       return FALSE;
+       return OK;
     if (stop_arrow() == FAIL)
-       return TRUE;
+       return FAIL;
     undisplay_dollar();
 
     /*
index 5026d6b2bb2d7718f71f74957f044d1e298d23ee..79863c4da91b5fbea8eb02f650f5c3107d8d1983 100644 (file)
@@ -198,3 +198,19 @@ func Test_map_timeout()
   set timeoutlen&
   delfunc ExitInsert
 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
index f80e22aff4804d20a41d746f50eff320c8588756..a79e38b918004969753d65b886b5b624700a1179 100644 (file)
@@ -761,6 +761,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1766,
 /**/
     1765,
 /**/