aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-07-11 08:02:59 +0800
committerGitHub <noreply@github.com>2024-07-11 08:02:59 +0800
commit45b7a2c50335e1943a36715101e40eda5a1423f3 (patch)
treea74b324a6edd148f7ee3c6debe142b46e4503ab4 /test
parentafbe7736a4966f22146d857f246eac01cd080773 (diff)
downloadrneovim-45b7a2c50335e1943a36715101e40eda5a1423f3.tar.gz
rneovim-45b7a2c50335e1943a36715101e40eda5a1423f3.tar.bz2
rneovim-45b7a2c50335e1943a36715101e40eda5a1423f3.zip
vim-patch:9.1.0557: moving in the buffer list doesn't work as documented (#29653)
Problem: moving in the buffer list doesn't work as documented (SenileFelineS) Solution: Skip non-help buffers, when run from normal buffers, else only move from help buffers to the next help buffer (LemonBoy) As explained in the help section for :bnext and :bprev the commands should jump from help buffers to help buffers (and from regular ones to regular ones). fixes: vim/vim#4478 closes: vim/vim#15198 https://github.com/vim/vim/commit/893eeeb44583ca33276e263165b2a6e50fd297d0 Co-authored-by: LemonBoy <thatlemon@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_buffer.vim46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/old/testdir/test_buffer.vim b/test/old/testdir/test_buffer.vim
index bc8e5eaf7b..69d22de2ce 100644
--- a/test/old/testdir/test_buffer.vim
+++ b/test/old/testdir/test_buffer.vim
@@ -126,6 +126,52 @@ func Test_buflist_browse()
%bwipe!
endfunc
+" Test for :bnext and :bprev when called from help and non-help buffers.
+func Test_bnext_bprev_help()
+ %bwipe!
+
+ e XHelp1 | set bt=help
+ let b1 = bufnr()
+ e Xbuf1
+ let b2 = bufnr()
+
+ " There's only one buffer of each type.
+ b XHelp1
+ bnext | call assert_equal(b1, bufnr())
+ bprev | call assert_equal(b1, bufnr())
+ b Xbuf1
+ bnext | call assert_equal(b2, bufnr())
+ bprev | call assert_equal(b2, bufnr())
+
+ " Add one more buffer of each type.
+ e XHelp2 | set bt=help
+ let b3 = bufnr()
+ e Xbuf2
+ let b4 = bufnr()
+
+ " Help buffer jumps to help buffer.
+ b XHelp1
+ bnext | call assert_equal(b3, bufnr())
+ bnext | call assert_equal(b1, bufnr())
+ bprev | call assert_equal(b3, bufnr())
+ bprev | call assert_equal(b1, bufnr())
+
+ " Regular buffer jumps to regular buffer.
+ b Xbuf1
+ bnext | call assert_equal(b4, bufnr())
+ bnext | call assert_equal(b2, bufnr())
+ bprev | call assert_equal(b4, bufnr())
+ bprev | call assert_equal(b2, bufnr())
+
+ " :brewind and :blast are not affected by the buffer type.
+ b Xbuf2
+ brewind | call assert_equal(b1, bufnr())
+ b XHelp1
+ blast | call assert_equal(b4, bufnr())
+
+ %bwipe!
+endfunc
+
" Test for :bdelete
func Test_bdelete_cmd()
%bwipe!