summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0248
blob: ca371b42374af2a7dc9256173720de601cd82ff0 (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
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0248
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.0248
Problem:    duplicated quickfix code.
Solution:   Move the code to a function.
Files:	    src/quickfix.c


*** ../vim-8.1.0247/src/quickfix.c	2018-08-01 17:53:04.693381270 +0200
--- src/quickfix.c	2018-08-01 20:00:00.659109066 +0200
***************
*** 4126,4131 ****
--- 4126,4145 ----
  }
  
  /*
+  * Jump to the first entry if there is one.
+  */
+     static void
+ qf_jump_first(qf_info_T *qi, int_u save_qfid, int forceit)
+ {
+     // If autocommands changed the current list, then restore it
+     if (qi->qf_lists[qi->qf_curlist].qf_id != save_qfid)
+ 	qi->qf_curlist = qf_id2nr(qi, save_qfid);
+ 
+     if (qi->qf_lists[qi->qf_curlist].qf_count > 0)
+ 	qf_jump(qi, 0, 0, forceit);
+ }
+ 
+ /*
   * Return TRUE when using ":vimgrep" for ":grep".
   */
      int
***************
*** 4247,4258 ****
  	apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
  					       curbuf->b_fname, TRUE, curbuf);
      if (res > 0 && !eap->forceit && qflist_valid(wp, save_qfid))
!     {
! 	// If autocommands changed the current list, then restore it
! 	if (qi->qf_lists[qi->qf_curlist].qf_id != save_qfid)
! 	    qi->qf_curlist = qf_id2nr(qi, save_qfid);
! 	qf_jump(qi, 0, 0, FALSE);		/* display first error */
!     }
  
  cleanup:
      mch_remove(fname);
--- 4261,4268 ----
  	apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
  					       curbuf->b_fname, TRUE, curbuf);
      if (res > 0 && !eap->forceit && qflist_valid(wp, save_qfid))
! 	// display the first error
! 	qf_jump_first(qi, save_qfid, FALSE);
  
  cleanup:
      mch_remove(fname);
***************
*** 4650,4659 ****
      if (res > 0 && (eap->cmdidx == CMD_cfile || eap->cmdidx == CMD_lfile)
  	    && qflist_valid(wp, save_qfid))
      {
! 	// If autocommands changed the current list, then restore it
! 	if (qi->qf_lists[qi->qf_curlist].qf_id != save_qfid)
! 	    qi->qf_curlist = qf_id2nr(qi, save_qfid);
! 	qf_jump(qi, 0, 0, eap->forceit);	/* display first error */
      }
  }
  
--- 4660,4667 ----
      if (res > 0 && (eap->cmdidx == CMD_cfile || eap->cmdidx == CMD_lfile)
  	    && qflist_valid(wp, save_qfid))
      {
! 	// display the first error
! 	qf_jump_first(qi, save_qfid, eap->forceit);
      }
  }
  
***************
*** 6361,6370 ****
  						eap->cmdidx == CMD_lbuffer)
  		    && qflist_valid(wp, save_qfid))
  	    {
! 		// If autocommands changed the current list, then restore it
! 		if (qi->qf_lists[qi->qf_curlist].qf_id != save_qfid)
! 		    qi->qf_curlist = qf_id2nr(qi, save_qfid);
! 		qf_jump(qi, 0, 0, eap->forceit);  /* display first error */
  	    }
  	}
      }
--- 6369,6376 ----
  						eap->cmdidx == CMD_lbuffer)
  		    && qflist_valid(wp, save_qfid))
  	    {
! 		// display the first error
! 		qf_jump_first(qi, save_qfid, eap->forceit);
  	    }
  	}
      }
***************
*** 6443,6452 ****
  						   || eap->cmdidx == CMD_lexpr)
  		    && qflist_valid(wp, save_qfid))
  	    {
! 		// If autocommands changed the current list, then restore it
! 		if (qi->qf_lists[qi->qf_curlist].qf_id != save_qfid)
! 		    qi->qf_curlist = qf_id2nr(qi, save_qfid);
! 		qf_jump(qi, 0, 0, eap->forceit);
  	    }
  	}
  	else
--- 6449,6456 ----
  						   || eap->cmdidx == CMD_lexpr)
  		    && qflist_valid(wp, save_qfid))
  	    {
! 		// display the first error
! 		qf_jump_first(qi, save_qfid, eap->forceit);
  	    }
  	}
  	else
*** ../vim-8.1.0247/src/version.c	2018-08-07 19:45:22.623218411 +0200
--- src/version.c	2018-08-07 19:47:15.006608513 +0200
***************
*** 796,797 ****
--- 796,799 ----
  {   /* Add new patch number below this line */
+ /**/
+     248,
  /**/

-- 
TALL KNIGHT: We are now no longer the Knights Who Say Ni!
ONE KNIGHT:  Ni!
OTHERS:      Sh!
ONE KNIGHT:  (whispers) Sorry.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

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