summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1389
blob: d4a0a612a49586ca1ea55eda0f83547f484b19c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1389
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.1389
Problem:    Changes are not flushed when end and start overlap. (Paul Jolly)
Solution:   When end of a previous changes overlaps with start of a new
            change, first flush listeners.
Files:	    src/change.c, src/testdir/test_listener.vim


*** ../vim-8.1.1388/src/change.c	2019-05-24 19:38:59.096545552 +0200
--- src/change.c	2019-05-24 21:34:33.627803910 +0200
***************
*** 172,187 ****
      if (buf->b_recorded_changes != NULL && xtra != 0)
      {
  	listitem_T *li;
! 	linenr_T    nr;
  
  	for (li = buf->b_recorded_changes->lv_first; li != NULL;
  							      li = li->li_next)
  	{
! 	    nr = (linenr_T)dict_get_number(
  				      li->li_tv.vval.v_dict, (char_u *)"lnum");
! 	    if (nr >= lnum || nr > lnume)
  	    {
! 		if (li->li_next == NULL && lnum == nr
  			&& col + 1 == (colnr_T)dict_get_number(
  				      li->li_tv.vval.v_dict, (char_u *)"col"))
  		{
--- 172,191 ----
      if (buf->b_recorded_changes != NULL && xtra != 0)
      {
  	listitem_T *li;
! 	linenr_T    prev_lnum;
! 	linenr_T    prev_lnume;
  
  	for (li = buf->b_recorded_changes->lv_first; li != NULL;
  							      li = li->li_next)
  	{
! 	    prev_lnum = (linenr_T)dict_get_number(
  				      li->li_tv.vval.v_dict, (char_u *)"lnum");
! 	    prev_lnume = (linenr_T)dict_get_number(
! 				       li->li_tv.vval.v_dict, (char_u *)"end");
! 	    if (prev_lnum >= lnum || prev_lnum > lnume
! 		    || (prev_lnume >= lnum && xtra != 0))
  	    {
! 		if (li->li_next == NULL && lnum == prev_lnum
  			&& col + 1 == (colnr_T)dict_get_number(
  				      li->li_tv.vval.v_dict, (char_u *)"col"))
  		{
***************
*** 195,202 ****
  							  (char_u *)"end", -1);
  			if (di != NULL)
  			{
! 			    nr = tv_get_number(&di->di_tv);
! 			    if (lnume > nr)
  				di->di_tv.vval.v_number = lnume;
  			}
  			di = dict_find(li->li_tv.vval.v_dict,
--- 199,206 ----
  							  (char_u *)"end", -1);
  			if (di != NULL)
  			{
! 			    prev_lnum = tv_get_number(&di->di_tv);
! 			    if (lnume > prev_lnum)
  				di->di_tv.vval.v_number = lnume;
  			}
  			di = dict_find(li->li_tv.vval.v_dict,
*** ../vim-8.1.1388/src/testdir/test_listener.vim	2019-05-16 22:11:43.715228803 +0200
--- src/testdir/test_listener.vim	2019-05-24 21:37:12.034786897 +0200
***************
*** 187,192 ****
--- 187,203 ----
  	\ {'lnum': 4, 'end': 5, 'col': 1, 'added': -1},
  	\ {'lnum': 6, 'end': 6, 'col': 1, 'added': 1}], s:list)
  
+   " split a line then insert one, should get two disconnected change lists
+   call setline(1, 'split here')
+   call listener_flush()
+   let s:list = []
+   exe "normal 1ggwi\<CR>\<Esc>"
+   1
+   normal o
+   call assert_equal([{'lnum': 1, 'end': 2, 'col': 7, 'added': 1}], s:list)
+   call listener_flush()
+   call assert_equal([{'lnum': 2, 'end': 2, 'col': 1, 'added': 1}], s:list)
+ 
    call listener_remove(id)
    bwipe!
  endfunc
*** ../vim-8.1.1388/src/version.c	2019-05-24 21:22:25.672809688 +0200
--- src/version.c	2019-05-24 21:30:04.381573735 +0200
***************
*** 769,770 ****
--- 769,772 ----
  {   /* Add new patch number below this line */
+ /**/
+     1389,
  /**/

-- 
Now it is such a bizarrely improbable coincidence that anything as
mind-bogglingly useful as the Babel fish could have evolved purely by chance
that some thinkers have chosen to see it as a final and clinching proof of the
NON-existence of God.
The argument goes something like this: 'I refuse to prove that I exist,' says
God, 'for proof denies faith, and without faith I am nothing.'
'But,' says Man, 'the Babel fish is a dead giveaway, isn't it?  It could not
have evolved by chance.  It proves you exist, and so therefore, by your own
arguments, you don't.  QED.'
'Oh dear,' says God, 'I hadn't thought of that,' and promptly vanishes in a
puff of logic.
'Oh, that was easy,' says Man, and for an encore goes on to prove that black
is white and gets himself killed on the next pedestrian crossing.
		-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

 /// Bram Moolenaar -- Bram@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    ///