summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0407
blob: aef42ebe7c1e97ed43dfec1a88ca5f6cb1b962b1 (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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0407
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.0407
Problem:    Quickfix code mixes using the stack and a list pointer.
Solution:   Use a list pointer in more places. (Yegappan Lakshmanan,
            closes #3443)
Files:	    src/quickfix.c


*** ../vim-8.1.0406/src/quickfix.c	2018-09-02 15:18:38.910627833 +0200
--- src/quickfix.c	2018-09-18 22:47:16.706525861 +0200
***************
*** 136,153 ****
  
  static void	qf_new_list(qf_info_T *qi, char_u *qf_title);
  static int	qf_add_entry(qf_info_T *qi, int qf_idx, char_u *dir, char_u *fname, char_u *module, int bufnum, char_u *mesg, long lnum, int col, int vis_col, char_u *pattern, int nr, int type, int valid);
! static void	qf_free(qf_info_T *qi, int idx);
  static char_u	*qf_types(int, int);
  static int	qf_get_fnum(qf_info_T *qi, int qf_idx, char_u *, char_u *);
  static char_u	*qf_push_dir(char_u *, struct dir_stack_T **, int is_file_stack);
  static char_u	*qf_pop_dir(struct dir_stack_T **);
! static char_u	*qf_guess_filepath(qf_info_T *qi, int qf_idx, char_u *);
  static void	qf_fmt_text(char_u *text, char_u *buf, int bufsize);
  static int	qf_win_pos_update(qf_info_T *qi, int old_qf_index);
  static win_T	*qf_find_win(qf_info_T *qi);
  static buf_T	*qf_find_buf(qf_info_T *qi);
  static void	qf_update_buffer(qf_info_T *qi, qfline_T *old_last);
- static void	qf_set_title_var(qf_info_T *qi);
  static void	qf_fill_buffer(qf_info_T *qi, buf_T *buf, qfline_T *old_last);
  static char_u	*get_mef_name(void);
  static buf_T	*load_dummy_buffer(char_u *fname, char_u *dirname_start, char_u *resulting_dir);
--- 136,152 ----
  
  static void	qf_new_list(qf_info_T *qi, char_u *qf_title);
  static int	qf_add_entry(qf_info_T *qi, int qf_idx, char_u *dir, char_u *fname, char_u *module, int bufnum, char_u *mesg, long lnum, int col, int vis_col, char_u *pattern, int nr, int type, int valid);
! static void	qf_free(qf_list_T *qfl);
  static char_u	*qf_types(int, int);
  static int	qf_get_fnum(qf_info_T *qi, int qf_idx, char_u *, char_u *);
  static char_u	*qf_push_dir(char_u *, struct dir_stack_T **, int is_file_stack);
  static char_u	*qf_pop_dir(struct dir_stack_T **);
! static char_u	*qf_guess_filepath(qf_list_T *qfl, char_u *);
  static void	qf_fmt_text(char_u *text, char_u *buf, int bufsize);
  static int	qf_win_pos_update(qf_info_T *qi, int old_qf_index);
  static win_T	*qf_find_win(qf_info_T *qi);
  static buf_T	*qf_find_buf(qf_info_T *qi);
  static void	qf_update_buffer(qf_info_T *qi, qfline_T *old_last);
  static void	qf_fill_buffer(qf_info_T *qi, buf_T *buf, qfline_T *old_last);
  static char_u	*get_mef_name(void);
  static buf_T	*load_dummy_buffer(char_u *fname, char_u *dirname_start, char_u *resulting_dir);
***************
*** 1757,1763 ****
      if (!adding)
      {
  	/* Error when creating a new list. Free the new list */
! 	qf_free(qi, qi->qf_curlist);
  	qi->qf_listcount--;
  	if (qi->qf_curlist > 0)
  	    --qi->qf_curlist;
--- 1756,1762 ----
      if (!adding)
      {
  	/* Error when creating a new list. Free the new list */
! 	qf_free(&qi->qf_lists[qi->qf_curlist]);
  	qi->qf_listcount--;
  	if (qi->qf_curlist > 0)
  	    --qi->qf_curlist;
***************
*** 1802,1816 ****
   * Prepends ':' to the title.
   */
      static void
! qf_store_title(qf_info_T *qi, int qf_idx, char_u *title)
  {
!     VIM_CLEAR(qi->qf_lists[qf_idx].qf_title);
  
      if (title != NULL)
      {
  	char_u *p = alloc((int)STRLEN(title) + 2);
  
! 	qi->qf_lists[qf_idx].qf_title = p;
  	if (p != NULL)
  	    STRCPY(p, title);
      }
--- 1801,1815 ----
   * Prepends ':' to the title.
   */
      static void
! qf_store_title(qf_list_T *qfl, char_u *title)
  {
!     VIM_CLEAR(qfl->qf_title);
  
      if (title != NULL)
      {
  	char_u *p = alloc((int)STRLEN(title) + 2);
  
! 	qfl->qf_title = p;
  	if (p != NULL)
  	    STRCPY(p, title);
      }
***************
*** 1847,1853 ****
       * way with ":grep'.
       */
      while (qi->qf_listcount > qi->qf_curlist + 1)
! 	qf_free(qi, --qi->qf_listcount);
  
      /*
       * When the stack is full, remove to oldest entry
--- 1846,1852 ----
       * way with ":grep'.
       */
      while (qi->qf_listcount > qi->qf_curlist + 1)
! 	qf_free(&qi->qf_lists[--qi->qf_listcount]);
  
      /*
       * When the stack is full, remove to oldest entry
***************
*** 1855,1861 ****
       */
      if (qi->qf_listcount == LISTCOUNT)
      {
! 	qf_free(qi, 0);
  	for (i = 1; i < LISTCOUNT; ++i)
  	    qi->qf_lists[i - 1] = qi->qf_lists[i];
  	qi->qf_curlist = LISTCOUNT - 1;
--- 1854,1860 ----
       */
      if (qi->qf_listcount == LISTCOUNT)
      {
! 	qf_free(&qi->qf_lists[0]);
  	for (i = 1; i < LISTCOUNT; ++i)
  	    qi->qf_lists[i - 1] = qi->qf_lists[i];
  	qi->qf_curlist = LISTCOUNT - 1;
***************
*** 1863,1874 ****
      else
  	qi->qf_curlist = qi->qf_listcount++;
      vim_memset(&qi->qf_lists[qi->qf_curlist], 0, (size_t)(sizeof(qf_list_T)));
!     qf_store_title(qi, qi->qf_curlist, qf_title);
      qi->qf_lists[qi->qf_curlist].qf_id = ++last_qf_id;
  }
  
  /*
!  * Free a location list
   */
      static void
  ll_free_all(qf_info_T **pqi)
--- 1862,1873 ----
      else
  	qi->qf_curlist = qi->qf_listcount++;
      vim_memset(&qi->qf_lists[qi->qf_curlist], 0, (size_t)(sizeof(qf_list_T)));
!     qf_store_title(&qi->qf_lists[qi->qf_curlist], qf_title);
      qi->qf_lists[qi->qf_curlist].qf_id = ++last_qf_id;
  }
  
  /*
!  * Free a location list stack
   */
      static void
  ll_free_all(qf_info_T **pqi)
***************
*** 1886,1892 ****
      {
  	/* No references to this location list */
  	for (i = 0; i < qi->qf_listcount; ++i)
! 	    qf_free(qi, i);
  	vim_free(qi);
      }
  }
--- 1885,1891 ----
      {
  	/* No references to this location list */
  	for (i = 0; i < qi->qf_listcount; ++i)
! 	    qf_free(&qi->qf_lists[i]);
  	vim_free(qi);
      }
  }
***************
*** 1909,1915 ****
      else
  	/* quickfix list */
  	for (i = 0; i < qi->qf_listcount; ++i)
! 	    qf_free(qi, i);
  }
  
  /*
--- 1908,1914 ----
      else
  	/* quickfix list */
  	for (i = 0; i < qi->qf_listcount; ++i)
! 	    qf_free(&qi->qf_lists[i]);
  }
  
  /*
***************
*** 1933,1938 ****
--- 1932,1938 ----
      int		type,		/* type character */
      int		valid)		/* valid entry */
  {
+     qf_list_T	*qfl = &qi->qf_lists[qf_idx];
      qfline_T	*qfp;
      qfline_T	**lastp;	/* pointer to qf_last or NULL */
  
***************
*** 1980,1991 ****
      qfp->qf_type = type;
      qfp->qf_valid = valid;
  
!     lastp = &qi->qf_lists[qf_idx].qf_last;
      if (qf_list_empty(qi, qf_idx))	/* first element in the list */
      {
! 	qi->qf_lists[qf_idx].qf_start = qfp;
! 	qi->qf_lists[qf_idx].qf_ptr = qfp;
! 	qi->qf_lists[qf_idx].qf_index = 0;
  	qfp->qf_prev = NULL;
      }
      else
--- 1980,1991 ----
      qfp->qf_type = type;
      qfp->qf_valid = valid;
  
!     lastp = &qfl->qf_last;
      if (qf_list_empty(qi, qf_idx))	/* first element in the list */
      {
! 	qfl->qf_start = qfp;
! 	qfl->qf_ptr = qfp;
! 	qfl->qf_index = 0;
  	qfp->qf_prev = NULL;
      }
      else
***************
*** 1996,2015 ****
      qfp->qf_next = NULL;
      qfp->qf_cleared = FALSE;
      *lastp = qfp;
!     ++qi->qf_lists[qf_idx].qf_count;
!     if (qi->qf_lists[qf_idx].qf_index == 0 && qfp->qf_valid)
  				/* first valid entry */
      {
! 	qi->qf_lists[qf_idx].qf_index =
! 	    qi->qf_lists[qf_idx].qf_count;
! 	qi->qf_lists[qf_idx].qf_ptr = qfp;
      }
  
      return OK;
  }
  
  /*
!  * Allocate a new location list
   */
      static qf_info_T *
  ll_new_list(void)
--- 1996,2014 ----
      qfp->qf_next = NULL;
      qfp->qf_cleared = FALSE;
      *lastp = qfp;
!     ++qfl->qf_count;
!     if (qfl->qf_index == 0 && qfp->qf_valid)
  				/* first valid entry */
      {
! 	qfl->qf_index = qfl->qf_count;
! 	qfl->qf_ptr = qfp;
      }
  
      return OK;
  }
  
  /*
!  * Allocate a new location list stack
   */
      static qf_info_T *
  ll_new_list(void)
***************
*** 2023,2030 ****
  }
  
  /*
!  * Return the location list for window 'wp'.
!  * If not present, allocate a location list
   */
      static qf_info_T *
  ll_get_or_alloc_list(win_T *wp)
--- 2022,2029 ----
  }
  
  /*
!  * Return the location list stack for window 'wp'.
!  * If not present, allocate a location list stack
   */
      static qf_info_T *
  ll_get_or_alloc_list(win_T *wp)
***************
*** 2197,2203 ****
  	if (mch_getperm(ptr) < 0)
  	{
  	    vim_free(ptr);
! 	    directory = qf_guess_filepath(qi, qf_idx, fname);
  	    if (directory)
  		ptr = concat_fnames(directory, fname, TRUE);
  	    else
--- 2196,2202 ----
  	if (mch_getperm(ptr) < 0)
  	{
  	    vim_free(ptr);
! 	    directory = qf_guess_filepath(&qi->qf_lists[qf_idx], fname);
  	    if (directory)
  		ptr = concat_fnames(directory, fname, TRUE);
  	    else
***************
*** 2365,2376 ****
   * qf_guess_filepath will return NULL.
   */
      static char_u *
! qf_guess_filepath(qf_info_T *qi, int qf_idx, char_u *filename)
  {
      struct dir_stack_T     *ds_ptr;
      struct dir_stack_T     *ds_tmp;
      char_u		   *fullname;
-     qf_list_T		   *qfl = &qi->qf_lists[qf_idx];
  
      /* no dirs on the stack - there's nothing we can do */
      if (qfl->qf_dir_stack == NULL)
--- 2364,2374 ----
   * qf_guess_filepath will return NULL.
   */
      static char_u *
! qf_guess_filepath(qf_list_T *qfl, char_u *filename)
  {
      struct dir_stack_T     *ds_ptr;
      struct dir_stack_T     *ds_tmp;
      char_u		   *fullname;
  
      /* no dirs on the stack - there's nothing we can do */
      if (qfl->qf_dir_stack == NULL)
***************
*** 2436,2449 ****
   * Similar to location list.
   */
      static int
! is_qf_entry_present(qf_info_T *qi, qfline_T *qf_ptr)
  {
-     qf_list_T	*qfl;
      qfline_T	*qfp;
      int		i;
  
-     qfl = &qi->qf_lists[qi->qf_curlist];
- 
      /* Search for the entry in the current list */
      for (i = 0, qfp = qfl->qf_start; i < qfl->qf_count;
  	    ++i, qfp = qfp->qf_next)
--- 2434,2444 ----
   * Similar to location list.
   */
      static int
! is_qf_entry_present(qf_list_T *qfl, qfline_T *qf_ptr)
  {
      qfline_T	*qfp;
      int		i;
  
      /* Search for the entry in the current list */
      for (i = 0, qfp = qfl->qf_start; i < qfl->qf_count;
  	    ++i, qfp = qfp->qf_next)
***************
*** 2462,2468 ****
   */
      static qfline_T *
  get_next_valid_entry(
! 	qf_info_T	*qi,
  	qfline_T	*qf_ptr,
  	int		*qf_index,
  	int		dir)
--- 2457,2463 ----
   */
      static qfline_T *
  get_next_valid_entry(
! 	qf_list_T	*qfl,
  	qfline_T	*qf_ptr,
  	int		*qf_index,
  	int		dir)
***************
*** 2475,2487 ****
  
      do
      {
! 	if (idx == qi->qf_lists[qi->qf_curlist].qf_count
! 		|| qf_ptr->qf_next == NULL)
  	    return NULL;
  	++idx;
  	qf_ptr = qf_ptr->qf_next;
!     } while ((!qi->qf_lists[qi->qf_curlist].qf_nonevalid
! 		&& !qf_ptr->qf_valid)
  	    || (dir == FORWARD_FILE && qf_ptr->qf_fnum == old_qf_fnum));
  
      *qf_index = idx;
--- 2470,2480 ----
  
      do
      {
! 	if (idx == qfl->qf_count || qf_ptr->qf_next == NULL)
  	    return NULL;
  	++idx;
  	qf_ptr = qf_ptr->qf_next;
!     } while ((!qfl->qf_nonevalid && !qf_ptr->qf_valid)
  	    || (dir == FORWARD_FILE && qf_ptr->qf_fnum == old_qf_fnum));
  
      *qf_index = idx;
***************
*** 2494,2500 ****
   */
      static qfline_T *
  get_prev_valid_entry(
! 	qf_info_T	*qi,
  	qfline_T	*qf_ptr,
  	int		*qf_index,
  	int		dir)
--- 2487,2493 ----
   */
      static qfline_T *
  get_prev_valid_entry(
! 	qf_list_T	*qfl,
  	qfline_T	*qf_ptr,
  	int		*qf_index,
  	int		dir)
***************
*** 2511,2518 ****
  	    return NULL;
  	--idx;
  	qf_ptr = qf_ptr->qf_prev;
!     } while ((!qi->qf_lists[qi->qf_curlist].qf_nonevalid
! 		&& !qf_ptr->qf_valid)
  	    || (dir == BACKWARD_FILE && qf_ptr->qf_fnum == old_qf_fnum));
  
      *qf_index = idx;
--- 2504,2510 ----
  	    return NULL;
  	--idx;
  	qf_ptr = qf_ptr->qf_prev;
!     } while ((!qfl->qf_nonevalid && !qf_ptr->qf_valid)
  	    || (dir == BACKWARD_FILE && qf_ptr->qf_fnum == old_qf_fnum));
  
      *qf_index = idx;
***************
*** 2527,2533 ****
   */
      static qfline_T *
  get_nth_valid_entry(
! 	qf_info_T	*qi,
  	int		errornr,
  	qfline_T	*qf_ptr,
  	int		*qf_index,
--- 2519,2525 ----
   */
      static qfline_T *
  get_nth_valid_entry(
! 	qf_list_T	*qfl,
  	int		errornr,
  	qfline_T	*qf_ptr,
  	int		*qf_index,
***************
*** 2544,2552 ****
  	prev_index = *qf_index;
  
  	if (dir == FORWARD || dir == FORWARD_FILE)
! 	    qf_ptr = get_next_valid_entry(qi, qf_ptr, qf_index, dir);
  	else
! 	    qf_ptr = get_prev_valid_entry(qi, qf_ptr, qf_index, dir);
  	if (qf_ptr == NULL)
  	{
  	    qf_ptr = prev_qf_ptr;
--- 2536,2544 ----
  	prev_index = *qf_index;
  
  	if (dir == FORWARD || dir == FORWARD_FILE)
! 	    qf_ptr = get_next_valid_entry(qfl, qf_ptr, qf_index, dir);
  	else
! 	    qf_ptr = get_prev_valid_entry(qfl, qf_ptr, qf_index, dir);
  	if (qf_ptr == NULL)
  	{
  	    qf_ptr = prev_qf_ptr;
***************
*** 2570,2576 ****
   */
      static qfline_T *
  get_nth_entry(
! 	qf_info_T	*qi,
  	int		errornr,
  	qfline_T	*qf_ptr,
  	int		*cur_qfidx)
--- 2562,2568 ----
   */
      static qfline_T *
  get_nth_entry(
! 	qf_list_T	*qfl,
  	int		errornr,
  	qfline_T	*qf_ptr,
  	int		*cur_qfidx)
***************
*** 2584,2592 ****
  	qf_ptr = qf_ptr->qf_prev;
      }
      /* New error number is greater than the current error number */
!     while (errornr > qf_idx &&
! 	    qf_idx < qi->qf_lists[qi->qf_curlist].qf_count &&
! 	    qf_ptr->qf_next != NULL)
      {
  	++qf_idx;
  	qf_ptr = qf_ptr->qf_next;
--- 2576,2583 ----
  	qf_ptr = qf_ptr->qf_prev;
      }
      /* New error number is greater than the current error number */
!     while (errornr > qf_idx && qf_idx < qfl->qf_count &&
! 						qf_ptr->qf_next != NULL)
      {
  	++qf_idx;
  	qf_ptr = qf_ptr->qf_next;
***************
*** 2784,2792 ****
  }
  
  /*
!  * Go to a window that shows the specified file. If a window is not found, go
!  * to the window just above the quickfix window. This is used for opening a
!  * file from a quickfix window and not from a location window.
   */
      static void
  qf_goto_win_with_qfl_file(int qf_fnum)
--- 2775,2784 ----
  }
  
  /*
!  * Go to a window that contains the specified buffer 'qf_fnum'. If a window is
!  * not found, then go to the window just above the quickfix window. This is
!  * used for opening a file from a quickfix window and not from a location
!  * window.
   */
      static void
  qf_goto_win_with_qfl_file(int qf_fnum)
***************
*** 2899,2904 ****
--- 2891,2897 ----
  	int		*opened_window,
  	int		*abort)
  {
+     qf_list_T	*qfl = &qi->qf_lists[qi->qf_curlist];
      int		retval = OK;
  
      if (qf_ptr->qf_type == 1)
***************
*** 2918,2924 ****
      else
      {
  	int old_qf_curlist = qi->qf_curlist;
! 	int save_qfid = qi->qf_lists[qi->qf_curlist].qf_id;
  
  	retval = buflist_getfile(qf_ptr->qf_fnum,
  		(linenr_T)1, GETF_SETMARK | GETF_SWITCH, forceit);
--- 2911,2917 ----
      else
      {
  	int old_qf_curlist = qi->qf_curlist;
! 	int save_qfid = qfl->qf_id;
  
  	retval = buflist_getfile(qf_ptr->qf_fnum,
  		(linenr_T)1, GETF_SETMARK | GETF_SWITCH, forceit);
***************
*** 2942,2948 ****
  	    }
  	}
  	else if (old_qf_curlist != qi->qf_curlist
! 		|| !is_qf_entry_present(qi, qf_ptr))
  	{
  	    if (IS_QF_STACK(qi))
  		EMSG(_("E925: Current quickfix was changed"));
--- 2935,2941 ----
  	    }
  	}
  	else if (old_qf_curlist != qi->qf_curlist
! 		|| !is_qf_entry_present(qfl, qf_ptr))
  	{
  	    if (IS_QF_STACK(qi))
  		EMSG(_("E925: Current quickfix was changed"));
***************
*** 3087,3092 ****
--- 3080,3086 ----
  	int		errornr,
  	int		forceit)
  {
+     qf_list_T		*qfl;
      qfline_T		*qf_ptr;
      qfline_T		*old_qf_ptr;
      int			qf_index;
***************
*** 3113,3125 ****
  	return;
      }
  
!     qf_ptr = qi->qf_lists[qi->qf_curlist].qf_ptr;
      old_qf_ptr = qf_ptr;
!     qf_index = qi->qf_lists[qi->qf_curlist].qf_index;
      old_qf_index = qf_index;
      if (dir != 0)    /* next/prev valid entry */
      {
! 	qf_ptr = get_nth_valid_entry(qi, errornr, qf_ptr, &qf_index, dir);
  	if (qf_ptr == NULL)
  	{
  	    qf_ptr = old_qf_ptr;
--- 3107,3121 ----
  	return;
      }
  
!     qfl = &qi->qf_lists[qi->qf_curlist];
! 
!     qf_ptr = qfl->qf_ptr;
      old_qf_ptr = qf_ptr;
!     qf_index = qfl->qf_index;
      old_qf_index = qf_index;
      if (dir != 0)    /* next/prev valid entry */
      {
! 	qf_ptr = get_nth_valid_entry(qfl, errornr, qf_ptr, &qf_index, dir);
  	if (qf_ptr == NULL)
  	{
  	    qf_ptr = old_qf_ptr;
***************
*** 3128,3136 ****
  	}
      }
      else if (errornr != 0)	/* go to specified number */
! 	qf_ptr = get_nth_entry(qi, errornr, qf_ptr, &qf_index);
  
!     qi->qf_lists[qi->qf_curlist].qf_index = qf_index;
      if (qf_win_pos_update(qi, old_qf_index))
  	/* No need to print the error message if it's visible in the error
  	 * window */
--- 3124,3132 ----
  	}
      }
      else if (errornr != 0)	/* go to specified number */
! 	qf_ptr = get_nth_entry(qfl, errornr, qf_ptr, &qf_index);
  
!     qfl->qf_index = qf_index;
      if (qf_win_pos_update(qi, old_qf_index))
  	/* No need to print the error message if it's visible in the error
  	 * window */
***************
*** 3215,3222 ****
  theend:
      if (qi != NULL)
      {
! 	qi->qf_lists[qi->qf_curlist].qf_ptr = qf_ptr;
! 	qi->qf_lists[qi->qf_curlist].qf_index = qf_index;
      }
      if (p_swb != old_swb && opened_window)
      {
--- 3211,3218 ----
  theend:
      if (qi != NULL)
      {
! 	qfl->qf_ptr = qf_ptr;
! 	qfl->qf_index = qf_index;
      }
      if (p_swb != old_swb && opened_window)
      {
***************
*** 3242,3250 ****
  /*
   * Display information about a single entry from the quickfix/location list.
   * Used by ":clist/:llist" commands.
   */
      static void
! qf_list_entry(qf_info_T *qi, qfline_T *qfp, int qf_idx)
  {
      char_u	*fname;
      buf_T	*buf;
--- 3238,3248 ----
  /*
   * Display information about a single entry from the quickfix/location list.
   * Used by ":clist/:llist" commands.
+  * 'cursel' will be set to TRUE for the currently selected entry in the
+  * quickfix list.
   */
      static void
! qf_list_entry(qfline_T *qfp, int qf_idx, int cursel)
  {
      char_u	*fname;
      buf_T	*buf;
***************
*** 3285,3292 ****
  	return;
  
      msg_putchar('\n');
!     msg_outtrans_attr(IObuff, qf_idx == qi->qf_lists[qi->qf_curlist].qf_index
! 	    ? HL_ATTR(HLF_QFL) : qfFileAttr);
  
      if (qfp->qf_lnum != 0)
  	msg_puts_attr((char_u *)":", qfSepAttr);
--- 3283,3289 ----
  	return;
  
      msg_putchar('\n');
!     msg_outtrans_attr(IObuff, cursel ? HL_ATTR(HLF_QFL) : qfFileAttr);
  
      if (qfp->qf_lnum != 0)
  	msg_puts_attr((char_u *)":", qfSepAttr);
***************
*** 3326,3331 ****
--- 3323,3329 ----
      void
  qf_list(exarg_T *eap)
  {
+     qf_list_T	*qfl;
      qfline_T	*qfp;
      int		i;
      int		idx1 = 1;
***************
*** 3362,3376 ****
  	EMSG(_(e_trailing));
  	return;
      }
      if (plus)
      {
! 	i = qi->qf_lists[qi->qf_curlist].qf_index;
  	idx2 = i + idx1;
  	idx1 = i;
      }
      else
      {
! 	i = qi->qf_lists[qi->qf_curlist].qf_count;
  	if (idx1 < 0)
  	    idx1 = (-idx1 > i) ? 0 : idx1 + i + 1;
  	if (idx2 < 0)
--- 3360,3375 ----
  	EMSG(_(e_trailing));
  	return;
      }
+     qfl = &qi->qf_lists[qi->qf_curlist];
      if (plus)
      {
! 	i = qfl->qf_index;
  	idx2 = i + idx1;
  	idx1 = i;
      }
      else
      {
! 	i = qfl->qf_count;
  	if (idx1 < 0)
  	    idx1 = (-idx1 > i) ? 0 : idx1 + i + 1;
  	if (idx2 < 0)
***************
*** 3394,3410 ****
      if (qfLineAttr == 0)
  	qfLineAttr = HL_ATTR(HLF_N);
  
!     if (qi->qf_lists[qi->qf_curlist].qf_nonevalid)
  	all = TRUE;
!     qfp = qi->qf_lists[qi->qf_curlist].qf_start;
!     for (i = 1; !got_int && i <= qi->qf_lists[qi->qf_curlist].qf_count; )
      {
  	if ((qfp->qf_valid || all) && idx1 <= i && i <= idx2)
  	{
  	    if (got_int)
  		break;
  
! 	    qf_list_entry(qi, qfp, i);
  	}
  
  	qfp = qfp->qf_next;
--- 3393,3409 ----
      if (qfLineAttr == 0)
  	qfLineAttr = HL_ATTR(HLF_N);
  
!     if (qfl->qf_nonevalid)
  	all = TRUE;
!     qfp = qfl->qf_start;
!     for (i = 1; !got_int && i <= qfl->qf_count; )
      {
  	if ((qfp->qf_valid || all) && idx1 <= i && i <= idx2)
  	{
  	    if (got_int)
  		break;
  
! 	    qf_list_entry(qfp, i, i == qfl->qf_index);
  	}
  
  	qfp = qfp->qf_next;
***************
*** 3547,3558 ****
   * associated with the list like context and title are not freed.
   */
      static void
! qf_free_items(qf_info_T *qi, int idx)
  {
      qfline_T	*qfp;
      qfline_T	*qfpnext;
      int		stop = FALSE;
-     qf_list_T	*qfl = &qi->qf_lists[idx];
  
      while (qfl->qf_count && qfl->qf_start != NULL)
      {
--- 3546,3556 ----
   * associated with the list like context and title are not freed.
   */
      static void
! qf_free_items(qf_list_T *qfl)
  {
      qfline_T	*qfp;
      qfline_T	*qfpnext;
      int		stop = FALSE;
  
      while (qfl->qf_count && qfl->qf_start != NULL)
      {
***************
*** 3595,3605 ****
   * associated context information and the title.
   */
      static void
! qf_free(qf_info_T *qi, int idx)
  {
!     qf_list_T	*qfl = &qi->qf_lists[idx];
! 
!     qf_free_items(qi, idx);
  
      VIM_CLEAR(qfl->qf_title);
      free_tv(qfl->qf_ctx);
--- 3593,3601 ----
   * associated context information and the title.
   */
      static void
! qf_free(qf_list_T *qfl)
  {
!     qf_free_items(qfl);
  
      VIM_CLEAR(qfl->qf_title);
      free_tv(qfl->qf_ctx);
***************
*** 3801,3806 ****
--- 3797,3812 ----
  }
  
  /*
+  * Set "w:quickfix_title" if "qi" has a title.
+  */
+     static void
+ qf_set_title_var(qf_list_T *qfl)
+ {
+     if (qfl->qf_title != NULL)
+ 	set_internal_string_var((char_u *)"w:quickfix_title", qfl->qf_title);
+ }
+ 
+ /*
   * ":copen": open a window that shows the list of errors.
   * ":lopen": open a window that shows the location list.
   */
***************
*** 3919,3925 ****
  	    prevwin = win;
      }
  
!     qf_set_title_var(qi);
  
      /*
       * Fill the buffer with the quickfix list.
--- 3925,3931 ----
  	    prevwin = win;
      }
  
!     qf_set_title_var(&qi->qf_lists[qi->qf_curlist]);
  
      /*
       * Fill the buffer with the quickfix list.
***************
*** 4033,4039 ****
  
  /*
   * Check whether the given window is displaying the specified quickfix/location
!  * list buffer
   */
      static int
  is_qf_win(win_T *win, qf_info_T *qi)
--- 4039,4045 ----
  
  /*
   * Check whether the given window is displaying the specified quickfix/location
!  * stack.
   */
      static int
  is_qf_win(win_T *win, qf_info_T *qi)
***************
*** 4053,4059 ****
  }
  
  /*
!  * Find a window displaying the quickfix/location list 'qi'
   * Only searches in the current tabpage.
   */
      static win_T *
--- 4059,4065 ----
  }
  
  /*
!  * Find a window displaying the quickfix/location stack 'qi'
   * Only searches in the current tabpage.
   */
      static win_T *
***************
*** 4097,4103 ****
      {
  	curwin_save = curwin;
  	curwin = win;
! 	qf_set_title_var(qi);
  	curwin = curwin_save;
      }
  }
--- 4103,4109 ----
      {
  	curwin_save = curwin;
  	curwin = win;
! 	qf_set_title_var(&qi->qf_lists[qi->qf_curlist]);
  	curwin = curwin_save;
      }
  }
***************
*** 4143,4159 ****
  }
  
  /*
-  * Set "w:quickfix_title" if "qi" has a title.
-  */
-     static void
- qf_set_title_var(qf_info_T *qi)
- {
-     if (qi->qf_lists[qi->qf_curlist].qf_title != NULL)
- 	set_internal_string_var((char_u *)"w:quickfix_title",
- 				    qi->qf_lists[qi->qf_curlist].qf_title);
- }
- 
- /*
   * Add an error line to the quickfix buffer.
   */
      static int
--- 4149,4154 ----
***************
*** 4679,4687 ****
   * For :cfdo and :lfdo returns the 'n'th valid file entry.
   */
      static int
! qf_get_nth_valid_entry(qf_info_T *qi, int n, int fdo)
  {
-     qf_list_T	*qfl = &qi->qf_lists[qi->qf_curlist];
      qfline_T	*qfp = qfl->qf_start;
      int		i, eidx;
      int		prev_fnum = 0;
--- 4674,4681 ----
   * For :cfdo and :lfdo returns the 'n'th valid file entry.
   */
      static int
! qf_get_nth_valid_entry(qf_list_T *qfl, int n, int fdo)
  {
      qfline_T	*qfp = qfl->qf_start;
      int		i, eidx;
      int		prev_fnum = 0;
***************
*** 4762,4768 ****
       */
      if (eap->cmdidx == CMD_cdo || eap->cmdidx == CMD_ldo
  	    || eap->cmdidx == CMD_cfdo || eap->cmdidx == CMD_lfdo)
! 	errornr = qf_get_nth_valid_entry(qi,
  		eap->addr_count > 0 ? (int)eap->line1 : 1,
  		eap->cmdidx == CMD_cfdo || eap->cmdidx == CMD_lfdo);
  
--- 4756,4762 ----
       */
      if (eap->cmdidx == CMD_cdo || eap->cmdidx == CMD_ldo
  	    || eap->cmdidx == CMD_cfdo || eap->cmdidx == CMD_lfdo)
! 	errornr = qf_get_nth_valid_entry(&qi->qf_lists[qi->qf_curlist],
  		eap->addr_count > 0 ? (int)eap->line1 : 1,
  		eap->cmdidx == CMD_cfdo || eap->cmdidx == CMD_lfdo);
  
***************
*** 5712,5718 ****
  			TRUE, (linenr_T)0, (linenr_T)0, NULL, NULL) > 0)
  	    {
  		(void)get_errorlist(qi, NULL, 0, l);
! 		qf_free(qi, 0);
  	    }
  	    free(qi);
  	}
--- 5706,5712 ----
  			TRUE, (linenr_T)0, (linenr_T)0, NULL, NULL) > 0)
  	    {
  		(void)get_errorlist(qi, NULL, 0, l);
! 		qf_free(&qi->qf_lists[0]);
  	    }
  	    free(qi);
  	}
***************
*** 5983,5988 ****
--- 5977,5983 ----
  qf_get_properties(win_T *wp, dict_T *what, dict_T *retdict)
  {
      qf_info_T	*qi = &ql_info;
+     qf_list_T	*qfl;
      int		status = OK;
      int		qf_idx;
      dictitem_T	*di;
***************
*** 6003,6008 ****
--- 5998,6005 ----
      if (qi == NULL || qi->qf_listcount == 0 || qf_idx == INVALID_QFIDX)
  	return qf_getprop_defaults(qi, flags, retdict);
  
+     qfl = &qi->qf_lists[qf_idx];
+ 
      if (flags & QF_GETLIST_TITLE)
  	status = qf_getprop_title(qi, qf_idx, retdict);
      if ((status == OK) && (flags & QF_GETLIST_NR))
***************
*** 6014,6028 ****
      if ((status == OK) && (flags & QF_GETLIST_CONTEXT))
  	status = qf_getprop_ctx(qi, qf_idx, retdict);
      if ((status == OK) && (flags & QF_GETLIST_ID))
! 	status = dict_add_number(retdict, "id", qi->qf_lists[qf_idx].qf_id);
      if ((status == OK) && (flags & QF_GETLIST_IDX))
  	status = qf_getprop_idx(qi, qf_idx, retdict);
      if ((status == OK) && (flags & QF_GETLIST_SIZE))
! 	status = dict_add_number(retdict, "size",
! 					      qi->qf_lists[qf_idx].qf_count);
      if ((status == OK) && (flags & QF_GETLIST_TICK))
! 	status = dict_add_number(retdict, "changedtick",
! 					qi->qf_lists[qf_idx].qf_changedtick);
      if ((status == OK) && (wp != NULL) && (flags & QF_GETLIST_FILEWINID))
  	status = qf_getprop_filewinid(wp, qi, retdict);
  
--- 6011,6023 ----
      if ((status == OK) && (flags & QF_GETLIST_CONTEXT))
  	status = qf_getprop_ctx(qi, qf_idx, retdict);
      if ((status == OK) && (flags & QF_GETLIST_ID))
! 	status = dict_add_number(retdict, "id", qfl->qf_id);
      if ((status == OK) && (flags & QF_GETLIST_IDX))
  	status = qf_getprop_idx(qi, qf_idx, retdict);
      if ((status == OK) && (flags & QF_GETLIST_SIZE))
! 	status = dict_add_number(retdict, "size", qfl->qf_count);
      if ((status == OK) && (flags & QF_GETLIST_TICK))
! 	status = dict_add_number(retdict, "changedtick", qfl->qf_changedtick);
      if ((status == OK) && (wp != NULL) && (flags & QF_GETLIST_FILEWINID))
  	status = qf_getprop_filewinid(wp, qi, retdict);
  
***************
*** 6118,6123 ****
--- 6113,6119 ----
  	char_u		*title,
  	int		action)
  {
+     qf_list_T	*qfl = &qi->qf_lists[qf_idx];
      listitem_T	*li;
      dict_T	*d;
      qfline_T	*old_last = NULL;
***************
*** 6128,6141 ****
  	/* make place for a new list */
  	qf_new_list(qi, title);
  	qf_idx = qi->qf_curlist;
      }
      else if (action == 'a' && !qf_list_empty(qi, qf_idx))
  	/* Adding to existing list, use last entry. */
! 	old_last = qi->qf_lists[qf_idx].qf_last;
      else if (action == 'r')
      {
! 	qf_free_items(qi, qf_idx);
! 	qf_store_title(qi, qf_idx, title);
      }
  
      for (li = list->lv_first; li != NULL; li = li->li_next)
--- 6124,6138 ----
  	/* make place for a new list */
  	qf_new_list(qi, title);
  	qf_idx = qi->qf_curlist;
+ 	qfl = &qi->qf_lists[qf_idx];
      }
      else if (action == 'a' && !qf_list_empty(qi, qf_idx))
  	/* Adding to existing list, use last entry. */
! 	old_last = qfl->qf_last;
      else if (action == 'r')
      {
! 	qf_free_items(qfl);
! 	qf_store_title(qfl, title);
      }
  
      for (li = list->lv_first; li != NULL; li = li->li_next)
***************
*** 6152,6168 ****
  	    break;
      }
  
!     if (qi->qf_lists[qf_idx].qf_index == 0)
  	/* no valid entry */
! 	qi->qf_lists[qf_idx].qf_nonevalid = TRUE;
      else
! 	qi->qf_lists[qf_idx].qf_nonevalid = FALSE;
      if (action != 'a')
      {
! 	qi->qf_lists[qf_idx].qf_ptr =
! 	    qi->qf_lists[qf_idx].qf_start;
  	if (!qf_list_empty(qi, qf_idx))
! 	    qi->qf_lists[qf_idx].qf_index = 1;
      }
  
      /* Don't update the cursor in quickfix window when appending entries */
--- 6149,6164 ----
  	    break;
      }
  
!     if (qfl->qf_index == 0)
  	/* no valid entry */
! 	qfl->qf_nonevalid = TRUE;
      else
! 	qfl->qf_nonevalid = FALSE;
      if (action != 'a')
      {
! 	qfl->qf_ptr = qfl->qf_start;
  	if (!qf_list_empty(qi, qf_idx))
! 	    qfl->qf_index = 1;
      }
  
      /* Don't update the cursor in quickfix window when appending entries */
***************
*** 6302,6308 ****
  	return FAIL;
  
      if (action == 'r')
! 	qf_free_items(qi, qf_idx);
      if (qf_init_ext(qi, qf_idx, NULL, NULL, &di->di_tv, errorformat,
  		FALSE, (linenr_T)0, (linenr_T)0, NULL, NULL) > 0)
  	retval = OK;
--- 6298,6304 ----
  	return FAIL;
  
      if (action == 'r')
! 	qf_free_items(&qi->qf_lists[qf_idx]);
      if (qf_init_ext(qi, qf_idx, NULL, NULL, &di->di_tv, errorformat,
  		FALSE, (linenr_T)0, (linenr_T)0, NULL, NULL) > 0)
  	retval = OK;
***************
*** 6314,6328 ****
   * Set quickfix list context.
   */
      static int
! qf_setprop_context(qf_info_T *qi, int qf_idx, dictitem_T *di)
  {
      typval_T	*ctx;
  
!     free_tv(qi->qf_lists[qf_idx].qf_ctx);
      ctx =  alloc_tv();
      if (ctx != NULL)
  	copy_tv(&di->di_tv, ctx);
!     qi->qf_lists[qf_idx].qf_ctx = ctx;
  
      return OK;
  }
--- 6310,6324 ----
   * Set quickfix list context.
   */
      static int
! qf_setprop_context(qf_list_T *qfl, dictitem_T *di)
  {
      typval_T	*ctx;
  
!     free_tv(qfl->qf_ctx);
      ctx =  alloc_tv();
      if (ctx != NULL)
  	copy_tv(&di->di_tv, ctx);
!     qfl->qf_ctx = ctx;
  
      return OK;
  }
***************
*** 6361,6367 ****
      if ((di = dict_find(what, (char_u *)"lines", -1)) != NULL)
  	retval = qf_setprop_items_from_lines(qi, qf_idx, what, di, action);
      if ((di = dict_find(what, (char_u *)"context", -1)) != NULL)
! 	retval = qf_setprop_context(qi, qf_idx, di);
  
      if (retval == OK)
  	qf_list_changed(qi, qf_idx);
--- 6357,6363 ----
      if ((di = dict_find(what, (char_u *)"lines", -1)) != NULL)
  	retval = qf_setprop_items_from_lines(qi, qf_idx, what, di, action);
      if ((di = dict_find(what, (char_u *)"context", -1)) != NULL)
! 	retval = qf_setprop_context(&qi->qf_lists[qf_idx], di);
  
      if (retval == OK)
  	qf_list_changed(qi, qf_idx);
***************
*** 6370,6376 ****
  }
  
  /*
!  * Find the non-location list window with the specified location list.
   */
      static win_T *
  find_win_with_ll(qf_info_T *qi)
--- 6366,6373 ----
  }
  
  /*
!  * Find the non-location list window with the specified location list in the
!  * current tabpage.
   */
      static win_T *
  find_win_with_ll(qf_info_T *qi)
***************
*** 6399,6405 ****
      {
  	/* If the quickfix/location list window is open, then clear it */
  	if (qi->qf_curlist < qi->qf_listcount)
! 	    qf_free(qi, qi->qf_curlist);
  	qf_update_buffer(qi, NULL);
      }
  
--- 6396,6402 ----
      {
  	/* If the quickfix/location list window is open, then clear it */
  	if (qi->qf_curlist < qi->qf_listcount)
! 	    qf_free(&qi->qf_lists[qi->qf_curlist]);
  	qf_update_buffer(qi, NULL);
      }
  
*** ../vim-8.1.0406/src/version.c	2018-09-18 22:37:26.976072822 +0200
--- src/version.c	2018-09-18 22:49:11.893423547 +0200
***************
*** 796,797 ****
--- 796,799 ----
  {   /* Add new patch number below this line */
+ /**/
+     407,
  /**/

-- 
From "know your smileys":
¯\_(ツ)_/¯   Shrug

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