summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0402
blob: f5e1ac7825bb030975f3754a9937ea420ed80f9a (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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0402
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.0402
Problem:    The DiffUpdate event isn't triggered for :diffput.
Solution:   Also trigger DiffUpdate for :diffget and :diffput.
Files:	    src/diff.c


*** ../vim-8.1.0401/src/diff.c	2018-09-16 18:10:45.246181729 +0200
--- src/diff.c	2018-09-18 20:54:19.844268349 +0200
***************
*** 295,301 ****
  
      if (diff_internal())
      {
! 	// Will udpate diffs before redrawing.  Set _invalid to update the
  	// diffs themselves, set _update to also update folds properly just
  	// before redrawing.
  	tp->tp_diff_invalid = TRUE;
--- 295,301 ----
  
      if (diff_internal())
      {
! 	// Will update diffs before redrawing.  Set _invalid to update the
  	// diffs themselves, set _update to also update folds properly just
  	// before redrawing.
  	tp->tp_diff_invalid = TRUE;
***************
*** 908,913 ****
--- 908,914 ----
      int		idx_orig;
      int		idx_new;
      diffio_T	diffio;
+     int		had_diffs = curtab->tp_first_diff != NULL;
  
      if (diff_busy)
      {
***************
*** 924,937 ****
  	if (curtab->tp_diffbuf[idx_orig] != NULL)
  	    break;
      if (idx_orig == DB_COUNT)
! 	return;
  
      // Only need to do something when there is another buffer.
      for (idx_new = idx_orig + 1; idx_new < DB_COUNT; ++idx_new)
  	if (curtab->tp_diffbuf[idx_new] != NULL)
  	    break;
      if (idx_new == DB_COUNT)
! 	return;
  
      // Only use the internal method if it did not fail for one of the buffers.
      vim_memset(&diffio, 0, sizeof(diffio));
--- 925,938 ----
  	if (curtab->tp_diffbuf[idx_orig] != NULL)
  	    break;
      if (idx_orig == DB_COUNT)
! 	goto theend;
  
      // Only need to do something when there is another buffer.
      for (idx_new = idx_orig + 1; idx_new < DB_COUNT; ++idx_new)
  	if (curtab->tp_diffbuf[idx_new] != NULL)
  	    break;
      if (idx_new == DB_COUNT)
! 	goto theend;
  
      // Only use the internal method if it did not fail for one of the buffers.
      vim_memset(&diffio, 0, sizeof(diffio));
***************
*** 948,956 ****
      // force updating cursor position on screen
      curwin->w_valid_cursor.lnum = 0;
  
!     diff_redraw(TRUE);
! 
!     apply_autocmds(EVENT_DIFFUPDATED, NULL, NULL, FALSE, curbuf);
  }
  
  /*
--- 949,962 ----
      // force updating cursor position on screen
      curwin->w_valid_cursor.lnum = 0;
  
! theend:
!     // A redraw is needed if there were diffs and they were cleared, or there
!     // are diffs now, which means they got updated.
!     if (had_diffs || curtab->tp_first_diff != NULL)
!     {
! 	diff_redraw(TRUE);
! 	apply_autocmds(EVENT_DIFFUPDATED, NULL, NULL, FALSE, curbuf);
!     }
  }
  
  /*
***************
*** 2272,2278 ****
      if ((diff_flags_new & DIFF_HORIZONTAL) && (diff_flags_new & DIFF_VERTICAL))
  	return FAIL;
  
!     /* If "icase" or "iwhite" was added or removed, need to update the diff. */
      if (diff_flags != diff_flags_new || diff_algorithm != diff_algorithm_new)
  	FOR_ALL_TABPAGES(tp)
  	    tp->tp_diff_invalid = TRUE;
--- 2278,2285 ----
      if ((diff_flags_new & DIFF_HORIZONTAL) && (diff_flags_new & DIFF_VERTICAL))
  	return FAIL;
  
!     // If flags were added or removed, or the algorithm was changed, need to
!     // update the diff.
      if (diff_flags != diff_flags_new || diff_algorithm != diff_algorithm_new)
  	FOR_ALL_TABPAGES(tp)
  	    tp->tp_diff_invalid = TRUE;
***************
*** 2845,2858 ****
  	diff_need_update = FALSE;
  	ex_diffupdate(NULL);
      }
! 
!     /* Check that the cursor is on a valid character and update it's position.
!      * When there were filler lines the topline has become invalid. */
!     check_cursor();
!     changed_line_abv_curs();
! 
!     /* Also need to redraw the other buffers. */
!     diff_redraw(FALSE);
  }
  
  #ifdef FEAT_FOLDING
--- 2852,2869 ----
  	diff_need_update = FALSE;
  	ex_diffupdate(NULL);
      }
!     else
!     {
! 	// Check that the cursor is on a valid character and update it's
! 	// position.  When there were filler lines the topline has become
! 	// invalid.
! 	check_cursor();
! 	changed_line_abv_curs();
! 
! 	// Also need to redraw the other buffers.
! 	diff_redraw(FALSE);
! 	apply_autocmds(EVENT_DIFFUPDATED, NULL, NULL, FALSE, curbuf);
!     }
  }
  
  #ifdef FEAT_FOLDING
*** ../vim-8.1.0401/src/version.c	2018-09-16 18:46:36.189127529 +0200
--- src/version.c	2018-09-18 20:55:27.799635739 +0200
***************
*** 796,797 ****
--- 796,799 ----
  {   /* Add new patch number below this line */
+ /**/
+     402,
  /**/

-- 
If your nose runs, and your feet smell, you might be upside down.

 /// 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    ///