Merge #9782 from janlazo/vim-8.1.0199

vim-patch:8.1.{199,200}
This commit is contained in:
Justin M. Keyes 2019-08-09 12:00:47 +02:00 committed by GitHub
commit 642e7daed5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 0 deletions

View File

@ -16759,6 +16759,8 @@ static void f_spellbadword(typval_T *argvars, typval_T *rettv, FunPtr fptr)
break;
}
str += len;
capcol -= len;
len = 0;
}
}
}

View File

@ -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