Skip to content

Commit 8eba2bd

Browse files
committed
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.
1 parent f7c7c3f commit 8eba2bd

3 files changed

Lines changed: 18 additions & 3 deletions

File tree

src/indent.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2076,8 +2076,11 @@ get_lisp_indent(void)
20762076
amount += 2;
20772077
else
20782078
{
2079-
that++;
2080-
amount++;
2079+
if (*that != NUL)
2080+
{
2081+
that++;
2082+
amount++;
2083+
}
20812084
firsttry = amount;
20822085

20832086
while (VIM_ISWHITE(*that))

src/testdir/test_lispwords.vim

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
" Tests for 'lispwords' settings being global-local
1+
" Tests for 'lispwords' settings being global-local.
2+
" And other lisp indent stuff.
23

34
set nocompatible viminfo+=nviminfo
45

@@ -85,4 +86,13 @@ func Test_lisp_indent()
8586
set nolisp
8687
endfunc
8788

89+
func Test_lisp_indent_works()
90+
" This was reading beyond the end of the line
91+
new
92+
exe "norm a\tü(\<CR>="
93+
set lisp
94+
norm ==
95+
bwipe!
96+
endfunc
97+
8898
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,8 @@ static char *(features[]) =
734734

735735
static int included_patches[] =
736736
{ /* Add new patch number below this line */
737+
/**/
738+
5151,
737739
/**/
738740
5150,
739741
/**/

0 commit comments

Comments
 (0)