aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-04-01 18:31:19 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-11-05 19:35:56 +0800
commit8b43091392ec895c77b83ff5964cd37b54976089 (patch)
tree9aa333349a3fa012ff07fd202f19736faf22e624
parentb92ed35a0bb873589bba9b51fdb92ffd00dc3e57 (diff)
downloadrneovim-8b43091392ec895c77b83ff5964cd37b54976089.tar.gz
rneovim-8b43091392ec895c77b83ff5964cd37b54976089.tar.bz2
rneovim-8b43091392ec895c77b83ff5964cd37b54976089.zip
vim-patch:8.2.4100: early return when getting the 'formatlistpat' value
Problem: Early return when getting the 'formatlistpat' value. Solution: Remove the first line. (Christian Brabandt) https://github.com/vim/vim/commit/04b871da800768287a8a432de568b11297db8686
-rw-r--r--src/nvim/option.c1
-rw-r--r--src/nvim/testdir/test_breakindent.vim17
2 files changed, 16 insertions, 2 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c
index dc9f01ff60..8142be4eb1 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -5225,7 +5225,6 @@ unsigned int get_bkc_value(buf_T *buf)
/// @param buf The buffer.
char *get_flp_value(buf_T *buf)
{
- return buf->b_p_flp ? buf->b_p_flp : p_flp;
if (buf->b_p_flp == NULL || *buf->b_p_flp == NUL) {
return p_flp;
}
diff --git a/src/nvim/testdir/test_breakindent.vim b/src/nvim/testdir/test_breakindent.vim
index a665ee5b28..8bbac2d237 100644
--- a/src/nvim/testdir/test_breakindent.vim
+++ b/src/nvim/testdir/test_breakindent.vim
@@ -930,7 +930,22 @@ func Test_no_extra_indent()
\ "~ ",
\ ]
let lines = s:screen_lines2(1, 4, 20)
- " 3) add something in front, no additional indent
+ " 3) no local formatlist pattern,
+ " so use global one -> indent
+ let g_flp = &g:flp
+ let &g:formatlistpat='^\s*\d\+\.\s\+'
+ let &l:formatlistpat=''
+ let expect = [
+ \ " 1. word word word ",
+ \ " word word word ",
+ \ " word word ",
+ \ "~ ",
+ \ ]
+ let lines = s:screen_lines2(1, 4, 20)
+ call s:compare_lines(expect, lines)
+ let &g:flp = g_flp
+ let &l:formatlistpat='^\s*\d\+\.'
+ " 4) add something in front, no additional indent
norm! gg0
exe ":norm! 5iword \<esc>"
redraw!