aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-08-09 12:00:47 +0200
committerGitHub <noreply@github.com>2019-08-09 12:00:47 +0200
commit642e7daed53386fedd0ef3a97483d6ea2b43ca77 (patch)
treebb0209652fc823c22799fc0f38cc0c0ef83c3357
parent3c0d6375925a7fbc22c82c0af47b42f036317eee (diff)
parent480794146fe09581d8459ea256e16e8e059b3f19 (diff)
downloadrneovim-642e7daed53386fedd0ef3a97483d6ea2b43ca77.tar.gz
rneovim-642e7daed53386fedd0ef3a97483d6ea2b43ca77.tar.bz2
rneovim-642e7daed53386fedd0ef3a97483d6ea2b43ca77.zip
Merge #9782 from janlazo/vim-8.1.0199
vim-patch:8.1.{199,200}
-rw-r--r--src/nvim/eval.c2
-rw-r--r--src/nvim/testdir/test_spell.vim41
2 files changed, 43 insertions, 0 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 3def9adcea..77347d4701 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -16759,6 +16759,8 @@ static void f_spellbadword(typval_T *argvars, typval_T *rettv, FunPtr fptr)
break;
}
str += len;
+ capcol -= len;
+ len = 0;
}
}
}
diff --git a/src/nvim/testdir/test_spell.vim b/src/nvim/testdir/test_spell.vim
index d7b8ca9e9c..230cb72335 100644
--- a/src/nvim/testdir/test_spell.vim
+++ b/src/nvim/testdir/test_spell.vim
@@ -69,6 +69,47 @@ func Test_z_equal_on_invalid_utf8_word()
bwipe!
endfunc
+" Test spellbadword() with argument
+func Test_spellbadword()
+ set spell
+
+ call assert_equal(['bycycle', 'bad'], spellbadword('My bycycle.'))
+ call assert_equal(['another', 'caps'], spellbadword('A sentence. another sentence'))
+
+ set spelllang=en
+ call assert_equal(['', ''], spellbadword('centre'))
+ call assert_equal(['', ''], spellbadword('center'))
+ set spelllang=en_us
+ call assert_equal(['centre', 'local'], spellbadword('centre'))
+ call assert_equal(['', ''], spellbadword('center'))
+ set spelllang=en_gb
+ call assert_equal(['', ''], spellbadword('centre'))
+ call assert_equal(['center', 'local'], spellbadword('center'))
+
+ " Create a small word list to test that spellbadword('...')
+ " can return ['...', 'rare'].
+ e Xwords
+ insert
+foo
+foobar/?
+.
+ w!
+ mkspell! Xwords.spl Xwords
+ set spelllang=Xwords.spl
+ call assert_equal(['foobar', 'rare'], spellbadword('foo foobar'))
+
+ " Typo should not be detected without the 'spell' option.
+ set spelllang=en_gb nospell
+ call assert_equal(['', ''], spellbadword('centre'))
+ call assert_equal(['', ''], spellbadword('My bycycle.'))
+ call assert_equal(['', ''], spellbadword('A sentence. another sentence'))
+
+ call delete('Xwords.spl')
+ call delete('Xwords')
+ set spelllang&
+ set spell&
+endfunc
+
func Test_spellreall()
new
set spell