aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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