Patch 8.1.2211
Problem:    Listener callback "added" argument is not the total. (Andy
            Massimino)
Solution:   Compute the total. (closes #5105)
Files:      src/change.c, src/testdir/test_listener.vim


*** ../vim-8.1.2210/src/change.c        2019-10-09 22:52:48.992043788 +0200
--- src/change.c        2019-10-24 20:05:58.599324286 +0200
***************
*** 371,379 ****
        if (start > lnum)
            start = lnum;
        lnum = dict_get_number(li->li_tv.vval.v_dict, (char_u *)"end");
!       if (lnum > end)
            end = lnum;
!       added = dict_get_number(li->li_tv.vval.v_dict, (char_u *)"added");
      }
      argv[1].v_type = VAR_NUMBER;
      argv[1].vval.v_number = start;
--- 371,379 ----
        if (start > lnum)
            start = lnum;
        lnum = dict_get_number(li->li_tv.vval.v_dict, (char_u *)"end");
!       if (end < lnum)
            end = lnum;
!       added += dict_get_number(li->li_tv.vval.v_dict, (char_u *)"added");
      }
      argv[1].v_type = VAR_NUMBER;
      argv[1].vval.v_number = start;
*** ../vim-8.1.2210/src/testdir/test_listener.vim       2019-09-08 
15:27:17.552004765 +0200
--- src/testdir/test_listener.vim       2019-10-24 20:05:31.531414113 +0200
***************
*** 1,7 ****
  " tests for listener_add() and listener_remove()
  
! func s:StoreList(s, l)
    let s:start = a:s
    let s:text = getline(a:s)
    let s:list = a:l
  endfunc
--- 1,9 ----
  " tests for listener_add() and listener_remove()
  
! func s:StoreList(s, e, a, l)
    let s:start = a:s
+   let s:end = a:e
+   let s:added = a:a
    let s:text = getline(a:s)
    let s:list = a:l
  endfunc
***************
*** 19,25 ****
    new
    call setline(1, ['one', 'two'])
    let s:list = []
!   let id = listener_add({b, s, e, a, l -> s:StoreList(s, l)})
    call setline(1, 'one one')
    call listener_flush()
    call assert_equal([{'lnum': 1, 'end': 2, 'col': 1, 'added': 0}], s:list)
--- 21,27 ----
    new
    call setline(1, ['one', 'two'])
    let s:list = []
!   let id = listener_add({b, s, e, a, l -> s:StoreList(s, e, a, l)})
    call setline(1, 'one one')
    call listener_flush()
    call assert_equal([{'lnum': 1, 'end': 2, 'col': 1, 'added': 0}], s:list)
***************
*** 65,70 ****
--- 67,75 ----
    call bufnr()->listener_flush()
    call assert_equal([{'lnum': 3, 'end': 3, 'col': 1, 'added': 1},
        \ {'lnum': 1, 'end': 2, 'col': 1, 'added': 0}], s:list)
+   call assert_equal(1, s:start)
+   call assert_equal(3, s:end)
+   call assert_equal(1, s:added)
  
    " an insert just above a previous change that was the last one does not get
    " merged
*** ../vim-8.1.2210/src/version.c       2019-10-24 19:24:56.531366030 +0200
--- src/version.c       2019-10-24 20:06:16.547264637 +0200
***************
*** 743,744 ****
--- 743,746 ----
  {   /* Add new patch number below this line */
+ /**/
+     2211,
  /**/

-- 
Are leaders born or made?  And if they're made, can we return them under
warranty?
                                (Scott Adams - The Dilbert principle)

 /// Bram Moolenaar -- [email protected] -- 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    ///

-- 
-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/201910241807.x9OI7Z0P021947%40masaka.moolenaar.net.

Raspunde prin e-mail lui