mirror of
https://github.com/neovim/neovim.git
synced 2026-08-25 00:21:55 +00:00
vim-patch:9.2.0914: diff: undo after :diffget into an empty buffer leaves a line behind (#41181)
Problem: After :diffget into an empty buffer, undo does not restore the
empty buffer, the last line stays behind (Narendran
Gopalakrishnan)
Solution: Include the empty line of the empty buffer in the undo
information, it is deleted once the first line was obtained
(Hirohito Higashi).
fixes: vim/vim#20950
closes: vim/vim#20951
c44f35ca1a
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -253,6 +253,24 @@ func Test_diffget_diffput()
|
||||
%bwipe!
|
||||
endfunc
|
||||
|
||||
" Undo after getting lines into an empty buffer must leave it empty again
|
||||
func Test_diffget_undo_empty_buffer()
|
||||
enew!
|
||||
diffthis
|
||||
new
|
||||
call setline(1, ['1', '2'])
|
||||
diffthis
|
||||
|
||||
wincmd p
|
||||
normal do
|
||||
call assert_equal(['1', '2'], getline(1, '$'))
|
||||
undo
|
||||
call assert_equal([''], getline(1, '$'))
|
||||
|
||||
windo diffoff
|
||||
%bwipe!
|
||||
endfunc
|
||||
|
||||
" Test putting two changes from one buffer to another
|
||||
func Test_diffput_two()
|
||||
new a
|
||||
|
||||
Reference in New Issue
Block a user