mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.1.0341: :argadd in empty buffer changes the buffer name
Problem: :argadd in empty buffer changes the buffer name. (Pavol Juhas) Solution: Don't re-use the current buffer when not going to edit the file. (closes #3397) Do re-use the current buffer for :next.
This commit is contained in:
@@ -80,6 +80,24 @@ func Test_argadd()
|
||||
call assert_equal(0, len(argv()))
|
||||
endfunc
|
||||
|
||||
func Test_argadd_empty_curbuf()
|
||||
new
|
||||
let curbuf = bufnr('%')
|
||||
call writefile(['test', 'Xargadd'], 'Xargadd')
|
||||
" must not re-use the current buffer.
|
||||
argadd Xargadd
|
||||
call assert_equal(curbuf, bufnr('%'))
|
||||
call assert_equal('', bufname('%'))
|
||||
call assert_equal(1, line('$'))
|
||||
rew
|
||||
call assert_notequal(curbuf, bufnr('%'))
|
||||
call assert_equal('Xargadd', bufname('%'))
|
||||
call assert_equal(2, line('$'))
|
||||
|
||||
%argd
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
func Init_abc()
|
||||
args a b c
|
||||
next
|
||||
|
@@ -158,7 +158,9 @@ endfunc
|
||||
func Test_command_count_4()
|
||||
%argd
|
||||
let bufnr = bufnr('$')
|
||||
arga aa bb cc dd ee ff
|
||||
next aa bb cc dd ee ff
|
||||
call assert_equal(bufnr, bufnr('%'))
|
||||
|
||||
3argu
|
||||
let args = []
|
||||
.,$-argdo call add(args, expand('%'))
|
||||
|
Reference in New Issue
Block a user