Steps to reproduce
$ cat <<"EOF" > listener-bug-report-minimal.vim
call setbufline(1, 1, ['pre ( part of line',
\ 'whole line',
\ 'part of line ) post'])
let g:lst = []
function EchoChanges(bufnr, start, end, added, changes)
for l:change in a:changes
let l:change.lines = getbufline(a:bufnr, l:change.lnum, l:change.end-1+l:change.added)
endfor
call add(g:lst, a:changes)
call writefile([string(a:changes)], '/tmp/listener.log', 'a')
endfunction
call listener_add("EchoChanges")
let @a=[
\ 'Cb_mirror',
\ 'line 2:',
\ 'E578: Not allowed to change text here'
\ ]->join("\n")
EOF
then open vim by
$ vim --clean -c "so listener-bug-report-minimal.vim"
inside vim, initiate 2 changes by run two command manually (or typing without call feedkyes)
call feedkeys('7|viw"ap')
call feedkeys('u')
Expected behaviour
The last change is incorrect. after call feedkeys('u'), a changes list with two change item being reported, i.e.,
[{'lnum': 1, 'col': 1, 'added': -2, 'end': 4, 'lines': ['pre ( part of line']},
{'lnum': 2, 'col': 1, 'added': 0, 'end': 2, 'lines': []}]
the second change.lnum is wrong, which should be 1.
I'm not sure the first change is right or not, since the meaning of lnum and end is not precisely defined, with regard to write a 100-percent reliable buffer mirror tool.
My thought on changes call feedkeys('u') should report:
case 1 un-merged
- two change being reported
- first change, two lines deleted, line 2 and 3
- second change, one line being changed, line 1 from
pre ( Cb_mirror to pre ( part of line
- in this specific scenario the order is unimportant and can be swapped
case 2 merged
- only 1 change being reported
- line 1 changed, line 2 and 3 deleted
Version of Vim
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Oct 01 2021 01:51:08) Included patches: 1-2434 Extra patches: 8.2.3402, 8.2.3403, 8.2.3409, 8.2.3428 Modified by team+vim@tracker.debian.org Compiled by team+vim@tracker.debian.org Huge version without GUI. Features included (+) or not (-): +acl +ipv6 +ruby +arabic +job +scrollbind +autocmd +jumplist +signs +autochdir +keymap +smartindent -autoservername +lambda -sound -balloon_eval +langmap +spell +balloon_eval_term +libcall +startuptime -browse +linebreak +statusline ++builtin_terms +lispindent -sun_workshop +byte_offset +listcmds +syntax +channel +localmap +tag_binary +cindent +lua -tag_old_static -clientserver +menu -tag_any_white -clipboard +mksession +tcl +cmdline_compl +modify_fname +termguicolors +cmdline_hist +mouse +terminal +cmdline_info -mouseshape +terminfo +comments +mouse_dec +termresponse +conceal +mouse_gpm +textobjects +cryptv -mouse_jsbterm +textprop +cscope +mouse_netterm +timers +cursorbind +mouse_sgr +title +cursorshape -mouse_sysmouse -toolbar +dialog_con +mouse_urxvt +user_commands +diff +mouse_xterm +vartabs +digraphs +multi_byte +vertsplit -dnd +multi_lang +virtualedit -ebcdic -mzscheme +visual +emacs_tags +netbeans_intg +visualextra +eval +num64 +viminfo +ex_extra +packages +vreplace +extra_search +path_extra +wildignore -farsi +perl +wildmenu +file_in_path +persistent_undo +windows +find_in_path +popupwin +writebackup +float +postscript -X11 +folding +printer -xfontset -footer +profile -xim +fork() -python -xpm +gettext +python3 -xsmp -hangul_input +quickfix -xterm_clipboard +iconv +reltime -xterm_save +insert_expand +rightleft system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" 2nd user vimrc file: "~/.vim/vimrc" user exrc file: "$HOME/.exrc" defaults file: "$VIMRUNTIME/defaults.vim" fall-back for $VIM: "/usr/share/vim" Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -Wdate-time -g -O2 -ffile-prefix-map=/build/vim-DtwDbo/vim-8.2.2434=. -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 Linking: gcc -L. -Wl,-z,relro -Wl,-z,now -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lm -ltinfo -lselinux -lacl -lattr -lgpm -ldl -L/usr/lib -llua5.2 -Wl,-E -fstack-protector-strong -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/perl/5.32/CORE -lperl -ldl -lm -lpthread -lcrypt -L/usr/lib/python3.9/config-3.9-x86_64-linux-gnu -lpython3.9 -lcrypt -lpthread -ldl -lutil -lm -lm -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lm -lruby-2.7 -lm -L/usr/lib
Environment
OS: Debian 11.1 without X11
$ cat /etc/debian_version
11.1
Logs and stack traces
No response
Steps to reproduce
then open vim by
inside vim, initiate 2 changes by run two command manually (or typing without call feedkyes)
Expected behaviour
The last change is incorrect. after
call feedkeys('u'), a changes list with two change item being reported, i.e.,the second change.lnum is wrong, which should be 1.
I'm not sure the first change is right or not, since the meaning of lnum and end is not precisely defined, with regard to write a 100-percent reliable buffer mirror tool.
My thought on changes
call feedkeys('u')should report:case 1 un-merged
pre ( Cb_mirrortopre ( part of linecase 2 merged
Version of Vim
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Oct 01 2021 01:51:08) Included patches: 1-2434 Extra patches: 8.2.3402, 8.2.3403, 8.2.3409, 8.2.3428 Modified by team+vim@tracker.debian.org Compiled by team+vim@tracker.debian.org Huge version without GUI. Features included (+) or not (-): +acl +ipv6 +ruby +arabic +job +scrollbind +autocmd +jumplist +signs +autochdir +keymap +smartindent -autoservername +lambda -sound -balloon_eval +langmap +spell +balloon_eval_term +libcall +startuptime -browse +linebreak +statusline ++builtin_terms +lispindent -sun_workshop +byte_offset +listcmds +syntax +channel +localmap +tag_binary +cindent +lua -tag_old_static -clientserver +menu -tag_any_white -clipboard +mksession +tcl +cmdline_compl +modify_fname +termguicolors +cmdline_hist +mouse +terminal +cmdline_info -mouseshape +terminfo +comments +mouse_dec +termresponse +conceal +mouse_gpm +textobjects +cryptv -mouse_jsbterm +textprop +cscope +mouse_netterm +timers +cursorbind +mouse_sgr +title +cursorshape -mouse_sysmouse -toolbar +dialog_con +mouse_urxvt +user_commands +diff +mouse_xterm +vartabs +digraphs +multi_byte +vertsplit -dnd +multi_lang +virtualedit -ebcdic -mzscheme +visual +emacs_tags +netbeans_intg +visualextra +eval +num64 +viminfo +ex_extra +packages +vreplace +extra_search +path_extra +wildignore -farsi +perl +wildmenu +file_in_path +persistent_undo +windows +find_in_path +popupwin +writebackup +float +postscript -X11 +folding +printer -xfontset -footer +profile -xim +fork() -python -xpm +gettext +python3 -xsmp -hangul_input +quickfix -xterm_clipboard +iconv +reltime -xterm_save +insert_expand +rightleft system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" 2nd user vimrc file: "~/.vim/vimrc" user exrc file: "$HOME/.exrc" defaults file: "$VIMRUNTIME/defaults.vim" fall-back for $VIM: "/usr/share/vim" Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -Wdate-time -g -O2 -ffile-prefix-map=/build/vim-DtwDbo/vim-8.2.2434=. -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 Linking: gcc -L. -Wl,-z,relro -Wl,-z,now -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lm -ltinfo -lselinux -lacl -lattr -lgpm -ldl -L/usr/lib -llua5.2 -Wl,-E -fstack-protector-strong -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/perl/5.32/CORE -lperl -ldl -lm -lpthread -lcrypt -L/usr/lib/python3.9/config-3.9-x86_64-linux-gnu -lpython3.9 -lcrypt -lpthread -ldl -lutil -lm -lm -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lm -lruby-2.7 -lm -L/usr/lib
Environment
OS: Debian 11.1 without X11
Logs and stack traces
No response