aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/indent_c.c4
-rw-r--r--src/nvim/testdir/test_cindent.vim7
2 files changed, 9 insertions, 2 deletions
diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c
index faa9b38cf7..93bfe6d822 100644
--- a/src/nvim/indent_c.c
+++ b/src/nvim/indent_c.c
@@ -152,11 +152,11 @@ static char_u *skip_string(char_u *p)
*/
for (;; p++) {
if (p[0] == '\'') { // 'c' or '\n' or '\000'
- if (!p[1]) { // ' at end of line
+ if (p[1] == NUL) { // ' at end of line
break;
}
i = 2;
- if (p[1] == '\\') { // '\n' or '\000'
+ if (p[1] == '\\' && p[2] != NUL) { // '\n' or '\000'
i++;
while (ascii_isdigit(p[i - 1])) { // '\000'
i++;
diff --git a/src/nvim/testdir/test_cindent.vim b/src/nvim/testdir/test_cindent.vim
index bd556387c6..055b578593 100644
--- a/src/nvim/testdir/test_cindent.vim
+++ b/src/nvim/testdir/test_cindent.vim
@@ -5296,4 +5296,11 @@ func Test_cindent_pragma()
enew! | close
endfunc
+func Test_backslash_at_end_of_line()
+ new
+ exe "norm v>O'\\\<C-m>-"
+ exe "norm \<C-q>="
+ bwipe!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab