aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-03-28 12:40:44 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-03-29 18:29:25 -0400
commit4564f2c54f2ab3af500cc81a3802570b57123a51 (patch)
tree8ddaf5fd4cdf4425a5d60596a17c21aaff87249c
parent375f957af65509bcf80c073362fae1d95bb32380 (diff)
downloadrneovim-4564f2c54f2ab3af500cc81a3802570b57123a51.tar.gz
rneovim-4564f2c54f2ab3af500cc81a3802570b57123a51.tar.bz2
rneovim-4564f2c54f2ab3af500cc81a3802570b57123a51.zip
vim-patch:8.2.1621: crash when using submatch(0, 1) in substitute()
Problem: Crash when using submatch(0, 1) in substitute(). Solution: Increment reference count. (closes vim/vim#6887) https://github.com/vim/vim/commit/8a0dcf43305586853f452a77fa295b0c8d54b463 N/A patches for version.c: vim-patch:8.2.2674: Motif: cancelling the font dialog resets the font Problem: Motif: cancelling the font dialog resets the font. Solution: When no font is selected to not change the font. (closes vim/vim#7825, closes vim/vim#8035) Fix compiler warnings. https://github.com/vim/vim/commit/9dbe701fe19597ad59c0e0c70a05927b587bea9f
-rw-r--r--src/nvim/regexp.c1
-rw-r--r--src/nvim/testdir/test_substitute.vim9
2 files changed, 10 insertions, 0 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c
index 8556757ddb..d7693c7a6f 100644
--- a/src/nvim/regexp.c
+++ b/src/nvim/regexp.c
@@ -7139,6 +7139,7 @@ list_T *reg_submatch_list(int no)
tv_list_append_string(list, s, (const char *)rsm.sm_match->endp[no] - s);
}
+ tv_list_ref(list);
return list;
}
diff --git a/src/nvim/testdir/test_substitute.vim b/src/nvim/testdir/test_substitute.vim
index 2a27f7a3a1..cc3bfe9f7f 100644
--- a/src/nvim/testdir/test_substitute.vim
+++ b/src/nvim/testdir/test_substitute.vim
@@ -746,3 +746,12 @@ func Test_sub_beyond_end()
call assert_equal('#', getline(1))
bwipe!
endfunc
+
+func Test_submatch_list_concatenate()
+ let pat = 'A\(.\)'
+ let Rep = {-> string([submatch(0, 1)] + [[submatch(1)]])}
+ " call substitute('A1', pat, Rep, '')->assert_equal("[['A1'], ['1']]")
+ call assert_equal(substitute('A1', pat, Rep, ''), "[['A1'], ['1']]")
+endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab