Patch 8.1.1486

131 views
Skip to first unread message

Bram Moolenaar

unread,
Jun 6, 2019, 4:51:00 PM6/6/19
to vim...@googlegroups.com

Patch 8.1.1486
Problem: A listener change is merged even when it adds a line. (Paul Jolly)
Solution: Do not merge a change that adds or removes a line. (closes #4490)
Files: src/change.c, src/testdir/test_listener.vim


*** ../vim-8.1.1485/src/change.c 2019-06-01 13:28:30.269829512 +0200
--- src/change.c 2019-06-06 19:58:19.326775932 +0200
***************
*** 186,191 ****
--- 186,192 ----
|| (prev_lnume >= lnum && xtra != 0))
{
if (li->li_next == NULL && lnum == prev_lnum
+ && xtra == 0
&& col + 1 == (colnr_T)dict_get_number(
li->li_tv.vval.v_dict, (char_u *)"col"))
{
*** ../vim-8.1.1485/src/testdir/test_listener.vim 2019-05-24 21:39:23.893950022 +0200
--- src/testdir/test_listener.vim 2019-06-06 20:04:46.320364378 +0200
***************
*** 28,36 ****
set undolevels& " start new undo block
call append(2, 'two two')
undo
redraw
! " the two changes get merged
! call assert_equal([{'lnum': 3, 'end': 4, 'col': 1, 'added': 0}], s:list)
1

" Two listeners, both get called. Also check column.
--- 28,37 ----
set undolevels& " start new undo block
call append(2, 'two two')
undo
+ call assert_equal([{'lnum': 3, 'end': 3, 'col': 1, 'added': 1}], s:list)
redraw
! " the two changes are not merged
! call assert_equal([{'lnum': 3, 'end': 4, 'col': 1, 'added': -1}], s:list)
1

" Two listeners, both get called. Also check column.
***************
*** 65,79 ****
call assert_equal([{'lnum': 3, 'end': 3, 'col': 1, 'added': 1},
\ {'lnum': 1, 'end': 2, 'col': 1, 'added': 0}], s:list)

! " an insert just above a previous change that was the last one gets merged
call setline(1, ['one one', 'two'])
call listener_flush()
let s:list = []
call setline(2, 'something')
call append(1, 'two two')
! call assert_equal([], s:list)
call listener_flush()
! call assert_equal([{'lnum': 2, 'end': 3, 'col': 1, 'added': 1}], s:list)

" an insert above a previous change causes a flush
call setline(1, ['one one', 'two'])
--- 66,81 ----
call assert_equal([{'lnum': 3, 'end': 3, 'col': 1, 'added': 1},
\ {'lnum': 1, 'end': 2, 'col': 1, 'added': 0}], s:list)

! " an insert just above a previous change that was the last one does not get
! " merged
call setline(1, ['one one', 'two'])
call listener_flush()
let s:list = []
call setline(2, 'something')
call append(1, 'two two')
! call assert_equal([{'lnum': 2, 'end': 3, 'col': 1, 'added': 0}], s:list)
call listener_flush()
! call assert_equal([{'lnum': 2, 'end': 2, 'col': 1, 'added': 1}], s:list)

" an insert above a previous change causes a flush
call setline(1, ['one one', 'two'])
***************
*** 86,98 ****
call assert_equal([{'lnum': 1, 'end': 1, 'col': 1, 'added': 1}], s:list)
call assert_equal('two two', s:text)

! " a delete at a previous change that was the last one gets merged
call setline(1, ['one one', 'two'])
call listener_flush()
let s:list = []
call setline(2, 'something')
2del
! call assert_equal([], s:list)
call listener_flush()
call assert_equal([{'lnum': 2, 'end': 3, 'col': 1, 'added': -1}], s:list)

--- 88,100 ----
call assert_equal([{'lnum': 1, 'end': 1, 'col': 1, 'added': 1}], s:list)
call assert_equal('two two', s:text)

! " a delete at a previous change that was the last one does not get merged
call setline(1, ['one one', 'two'])
call listener_flush()
let s:list = []
call setline(2, 'something')
2del
! call assert_equal([{'lnum': 2, 'end': 3, 'col': 1, 'added': 0}], s:list)
call listener_flush()
call assert_equal([{'lnum': 2, 'end': 3, 'col': 1, 'added': -1}], s:list)

*** ../vim-8.1.1485/src/version.c 2019-06-06 19:03:14.388227807 +0200
--- src/version.c 2019-06-06 22:50:01.509039136 +0200
***************
*** 769,770 ****
--- 769,772 ----
{ /* Add new patch number below this line */
+ /**/
+ 1486,
/**/

--
hundred-and-one symptoms of being an internet addict:
107. When using your phone you forget that you don't have to use your
keyboard.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Christian Brabandt

unread,
Jun 7, 2019, 8:25:40 AM6/7/19
to vim...@googlegroups.com

On Do, 06 Jun 2019, Bram Moolenaar wrote:

> Patch 8.1.1486

Congratulations to 10,000 commits on github ;)

Best,
Christian
--
Und damit das nur gleich klar ist, wir können auch außerhalb einer
Pressekonferenz fabelhaft auch uns zum Tee treffen ...
-- Der verrückte Hutmacher
(Marc-Uwe Kling: Falsch zugeordnete Zitate; eigentlich Guido Westerwelle)

Paul Jolly

unread,
Jun 7, 2019, 8:28:41 AM6/7/19
to vim...@googlegroups.com
+10,000!
> --
> --
> You received this message from the "vim_dev" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups "vim_dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/20190607122537.GW23877%40256bit.org.
> For more options, visit https://groups.google.com/d/optout.

Bram Moolenaar

unread,
Jun 7, 2019, 12:20:23 PM6/7/19
to vim...@googlegroups.com, Christian Brabandt

Christian wrote:

> On Do, 06 Jun 2019, Bram Moolenaar wrote:
>
> > Patch 8.1.1486
>
> Congratulations to 10,000 commits on github ;)

Maybe I should stop here?

--
hundred-and-one symptoms of being an internet addict:
109. You actually read -- and enjoy -- lists like this.

Yegappan Lakshmanan

unread,
Jun 7, 2019, 12:40:04 PM6/7/19
to vim_dev, Christian Brabandt
Hi,

On Fri, Jun 7, 2019 at 9:20 AM Bram Moolenaar <Br...@moolenaar.net> wrote:
>
> Christian wrote:
>
> > On Do, 06 Jun 2019, Bram Moolenaar wrote:
> >
> > > Patch 8.1.1486
> >
> > Congratulations to 10,000 commits on github ;)
>
> Maybe I should stop here?
>

No :-). There are many more decades of Vim development ahead of you
(for the betterment of developers across the world).

Regards,
Yegappan

Bram Moolenaar

unread,
Jun 7, 2019, 3:30:17 PM6/7/19
to vim...@googlegroups.com, Yegappan Lakshmanan, Christian Brabandt
OK, I'll aim for 16384 now.

--
hundred-and-one symptoms of being an internet addict:
113. You are asked about a bus schedule, you wonder if it is 16 or 32 bits.
Reply all
Reply to author
Forward
0 new messages