vim-patch:partial:9.0.0737: Lisp word only recognized when a space follows

Problem:    Lisp word only recognized when a space follows.
Solution:   Also match a word at the end of a line.  Rename the test.  Use a
            compiled function to avoid backslashes.
d26c5805bc

Keep the old Test_lisp_indent().
This commit is contained in:
zeertzjq 2022-10-15 19:25:51 +08:00
parent 433818351b
commit eaac095825
3 changed files with 6 additions and 2 deletions

View File

@ -1138,7 +1138,7 @@ static int lisp_match(char_u *p)
(void)copy_option_part(&word, (char *)buf, LSIZE, ","); (void)copy_option_part(&word, (char *)buf, LSIZE, ",");
len = (int)STRLEN(buf); len = (int)STRLEN(buf);
if ((STRNCMP(buf, p, len) == 0) && (p[len] == ' ')) { if ((STRNCMP(buf, p, len) == 0) && ascii_iswhite_or_nul(p[len])) {
return true; return true;
} }
} }

View File

@ -15,7 +15,6 @@ source test_fnamemodify.vim
source test_ga.vim source test_ga.vim
source test_glob2regpat.vim source test_glob2regpat.vim
source test_global.vim source test_global.vim
source test_lispwords.vim
source test_move.vim source test_move.vim
source test_put.vim source test_put.vim
source test_reltime.vim source test_reltime.vim

View File

@ -86,6 +86,11 @@ func Test_lisp_indent()
set nolisp set nolisp
endfunc endfunc
func Test_lispindent_negative()
" in legacy script there is no error
call assert_equal(-1, lispindent(-1))
endfunc
func Test_lisp_indent_works() func Test_lisp_indent_works()
" This was reading beyond the end of the line " This was reading beyond the end of the line
new new