aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-06-23 06:33:01 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-06-23 06:34:56 +0800
commita4d7394bc8acba0d67f0e2ad7b5645007e37417a (patch)
treee93ed3e43c866b2c6a83c4bb7d76fc843d9c3390 /src
parentf0889154954f0069e19d4196e3a902499f355ed0 (diff)
downloadrneovim-a4d7394bc8acba0d67f0e2ad7b5645007e37417a.tar.gz
rneovim-a4d7394bc8acba0d67f0e2ad7b5645007e37417a.tar.bz2
rneovim-a4d7394bc8acba0d67f0e2ad7b5645007e37417a.zip
vim-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. https://github.com/vim/vim/commit/8eba2bd291b347e3008aa9e565652d51ad638cfa
Diffstat (limited to 'src')
-rw-r--r--src/nvim/indent.c6
-rw-r--r--src/nvim/testdir/test_lispwords.vim12
2 files changed, 15 insertions, 3 deletions
diff --git a/src/nvim/indent.c b/src/nvim/indent.c
index 010d2fe869..d71b3adb5c 100644
--- a/src/nvim/indent.c
+++ b/src/nvim/indent.c
@@ -697,8 +697,10 @@ int get_lisp_indent(void)
&& lisp_match(that + 1)) {
amount += 2;
} else {
- that++;
- amount++;
+ if (*that != NUL) {
+ that++;
+ amount++;
+ }
firsttry = amount;
while (ascii_iswhite(*that)) {
diff --git a/src/nvim/testdir/test_lispwords.vim b/src/nvim/testdir/test_lispwords.vim
index ff710b2716..4144fb0521 100644
--- a/src/nvim/testdir/test_lispwords.vim
+++ b/src/nvim/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
@@ -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