0
0
mirror of https://github.com/vim/vim.git synced 2025-11-16 23:24:03 -05:00

patch 9.1.0557: moving in the buffer list doesn't work as documented

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: #4478
closes: #15198

Signed-off-by: LemonBoy <thatlemon@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
LemonBoy
2024-07-10 20:20:48 +02:00
committed by Christian Brabandt
parent 7a85e343d2
commit 893eeeb445
5 changed files with 79 additions and 5 deletions

View File

@@ -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!