Skip to content
Permalink
Browse files Browse the repository at this point in the history
patch 8.2.5151: reading beyond the end of the line with lisp indenting
Problem:    Reading beyond the end of the line with lisp indenting.
Solution:   Avoid going over the NUL at the end of the line.
  • Loading branch information
brammool committed Jun 22, 2022
1 parent f7c7c3f commit 8eba2bd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/indent.c
Expand Up @@ -2076,8 +2076,11 @@ get_lisp_indent(void)
amount += 2;
else
{
that++;
amount++;
if (*that != NUL)
{
that++;
amount++;
}
firsttry = amount;

while (VIM_ISWHITE(*that))
Expand Down
12 changes: 11 additions & 1 deletion src/testdir/test_lispwords.vim
@@ -1,4 +1,5 @@
" Tests for 'lispwords' settings being global-local
" Tests for 'lispwords' settings being global-local.
" And other lisp indent stuff.

set nocompatible viminfo+=nviminfo

Expand Down Expand Up @@ -85,4 +86,13 @@ func Test_lisp_indent()
set nolisp
endfunc

func Test_lisp_indent_works()
" This was reading beyond the end of the line
new
exe "norm a\tü(\<CR>="
set lisp
norm ==
bwipe!
endfunc

" vim: shiftwidth=2 sts=2 expandtab
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -734,6 +734,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
5151,
/**/
5150,
/**/
Expand Down

0 comments on commit 8eba2bd

Please sign in to comment.