]> granicus.if.org Git - vim/commitdiff
patch 8.2.5151: reading beyond the end of the line with lisp indenting v8.2.5151
authorBram Moolenaar <Bram@vim.org>
Wed, 22 Jun 2022 18:59:28 +0000 (19:59 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 22 Jun 2022 18:59:28 +0000 (19:59 +0100)
Problem:    Reading beyond the end of the line with lisp indenting.
Solution:   Avoid going over the NUL at the end of the line.

src/indent.c
src/testdir/test_lispwords.vim
src/version.c

index fa177bcf2c791eeeb8b154727f871a12947301ab..f6cfe4b2f82788792aed63852b15a0c6dea0a7ae 100644 (file)
@@ -2076,8 +2076,11 @@ get_lisp_indent(void)
                    amount += 2;
                else
                {
-                   that++;
-                   amount++;
+                   if (*that != NUL)
+                   {
+                       that++;
+                       amount++;
+                   }
                    firsttry = amount;
 
                    while (VIM_ISWHITE(*that))
index ff710b271633fea592fc5096ee7c368810a002e6..4144fb05211fb5593385a034b9821afd1749d8a5 100644 (file)
@@ -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
 
@@ -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
index b947061b3ffeaed3aa5e8ec8707f60978c0d3ae5..bb3f1665fe82ba785d1fc094c0dba887afdc3afa 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    5151,
 /**/
     5150,
 /**/