summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0267
blob: 7d332c33363a9f3ec125561c62c92490e81a9253 (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
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0267
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.0267
Problem:    No good check if restoring quickfix list worked.
Solution:   Let qf_restore_list() return OK/FAIL. (Yegappan Lakshmanan)
Files:	    src/quickfix.c


*** ../vim-8.1.0266/src/quickfix.c	2018-08-09 21:52:20.716362389 +0200
--- src/quickfix.c	2018-08-11 13:35:15.874757811 +0200
***************
*** 4338,4345 ****
   * If the current list is not "save_qfid" and we can find the list with that ID
   * then make it the current list.
   * This is used when autocommands may have changed the current list.
   */
!     static void
  qf_restore_list(qf_info_T *qi, int_u save_qfid)
  {
      int curlist;
--- 4338,4347 ----
   * If the current list is not "save_qfid" and we can find the list with that ID
   * then make it the current list.
   * This is used when autocommands may have changed the current list.
+  * Returns OK if successfully restored the list. Returns FAIL if the list with
+  * the specified identifier (save_qfid) is not found in the stack.
   */
!     static int
  qf_restore_list(qf_info_T *qi, int_u save_qfid)
  {
      int curlist;
***************
*** 4347,4356 ****
      if (qi->qf_lists[qi->qf_curlist].qf_id != save_qfid)
      {
  	curlist = qf_id2nr(qi, save_qfid);
! 	if (curlist >= 0)
! 	    qi->qf_curlist = curlist;
! 	// else: what if the list can't be found?
      }
  }
  
  /*
--- 4349,4360 ----
      if (qi->qf_lists[qi->qf_curlist].qf_id != save_qfid)
      {
  	curlist = qf_id2nr(qi, save_qfid);
! 	if (curlist < 0)
! 	    // list is not present
! 	    return FAIL;
! 	qi->qf_curlist = curlist;
      }
+     return OK;
  }
  
  /*
***************
*** 4359,4367 ****
      static void
  qf_jump_first(qf_info_T *qi, int_u save_qfid, int forceit)
  {
!     qf_restore_list(qi, save_qfid);
  
!     // Autocommands might have cleared the list, check for it
      if (!qf_list_empty(qi, qi->qf_curlist))
  	qf_jump(qi, 0, 0, forceit);
  }
--- 4363,4372 ----
      static void
  qf_jump_first(qf_info_T *qi, int_u save_qfid, int forceit)
  {
!     if (qf_restore_list(qi, save_qfid) == FAIL)
! 	return;
  
!     // Autocommands might have cleared the list, check for that.
      if (!qf_list_empty(qi, qi->qf_curlist))
  	qf_jump(qi, 0, 0, forceit);
  }
***************
*** 5025,5031 ****
  	}
      }
  
!     qf_restore_list(qi, qfid);
  
      return TRUE;
  }
--- 5030,5037 ----
  	}
      }
  
!     if (qf_restore_list(qi, qfid) == FAIL)
! 	return FALSE;
  
      return TRUE;
  }
***************
*** 5371,5377 ****
      if (!qflist_valid(wp, save_qfid))
  	goto theend;
  
!     qf_restore_list(qi, save_qfid);
  
      /* Jump to first match. */
      if (!qf_list_empty(qi, qi->qf_curlist))
--- 5377,5384 ----
      if (!qflist_valid(wp, save_qfid))
  	goto theend;
  
!     if (qf_restore_list(qi, save_qfid) == FAIL)
! 	goto theend;
  
      /* Jump to first match. */
      if (!qf_list_empty(qi, qi->qf_curlist))
*** ../vim-8.1.0266/src/version.c	2018-08-10 23:13:07.934024645 +0200
--- src/version.c	2018-08-11 13:32:28.919832152 +0200
***************
*** 796,797 ****
--- 796,799 ----
  {   /* Add new patch number below this line */
+ /**/
+     267,
  /**/

-- 
BRIDGEKEEPER: What is your favorite editor?
GAWAIN:       Emacs ...  No, Viiiiiiiiiiimmmmmmm!
           "Monty Python and the Holy editor wars" PYTHON (MONTY) SOFTWARE 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    ///