summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1275
blob: be6dd626d21afe2f2018dbfdb5256a9efc927aad (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
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1275
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.1275
Problem:    Cannot navigate to errors before/after the cursor.
Solution:   Add the :cbefore and :cafter commands. (Yegappan Lakshmanan,
            closes #4340)
Files:	    runtime/doc/index.txt, runtime/doc/quickfix.txt, src/ex_cmdidxs.h,
            src/ex_cmds.h, src/quickfix.c, src/testdir/test_quickfix.vim


*** ../vim-8.1.1274/runtime/doc/index.txt	2019-05-03 21:56:31.363540578 +0200
--- runtime/doc/index.txt	2019-05-05 14:56:42.134251046 +0200
***************
*** 1144,1152 ****
  |:caddbuffer|	:cad[dbuffer]	add errors from buffer
  |:caddexpr|	:cadde[xpr]	add errors from expr
  |:caddfile|	:caddf[ile]	add error message to current quickfix list
  |:call|		:cal[l]		call a function
  |:catch|	:cat[ch]	part of a :try command
! |:cbelow|	:cbe[low]	got to error below current line
  |:cbottom|	:cbo[ttom]	scroll to the bottom of the quickfix window
  |:cbuffer|	:cb[uffer]	parse error messages and jump to first error
  |:cc|		:cc		go to specific error
--- 1196,1206 ----
  |:caddbuffer|	:cad[dbuffer]	add errors from buffer
  |:caddexpr|	:cadde[xpr]	add errors from expr
  |:caddfile|	:caddf[ile]	add error message to current quickfix list
+ |:cafter|	:caf[ter]	go to error after current cursor
  |:call|		:cal[l]		call a function
  |:catch|	:cat[ch]	part of a :try command
! |:cbefore|	:cbef[ore]	go to error before current cursor
! |:cbelow|	:cbel[ow]	go to error below current line
  |:cbottom|	:cbo[ttom]	scroll to the bottom of the quickfix window
  |:cbuffer|	:cb[uffer]	parse error messages and jump to first error
  |:cc|		:cc		go to specific error
***************
*** 1308,1317 ****
  |:laddexpr|	:lad[dexpr]	add locations from expr
  |:laddbuffer|	:laddb[uffer]	add locations from buffer
  |:laddfile|	:laddf[ile]	add locations to current location list
  |:last|		:la[st]		go to the last file in the argument list
  |:language|	:lan[guage]	set the language (locale)
  |:later|	:lat[er]	go to newer change, redo
! |:lbelow|	:lbe[low]	go to location below current line
  |:lbottom|	:lbo[ttom]	scroll to the bottom of the location window
  |:lbuffer|	:lb[uffer]	parse locations and jump to first location
  |:lcd|		:lc[d]		change directory locally
--- 1362,1373 ----
  |:laddexpr|	:lad[dexpr]	add locations from expr
  |:laddbuffer|	:laddb[uffer]	add locations from buffer
  |:laddfile|	:laddf[ile]	add locations to current location list
+ |:lafter|	:laf[ter]	go to location after current cursor
  |:last|		:la[st]		go to the last file in the argument list
  |:language|	:lan[guage]	set the language (locale)
  |:later|	:lat[er]	go to newer change, redo
! |:lbefore|	:lbef[ore]	go to location before current cursor
! |:lbelow|	:lbel[ow]	go to location below current line
  |:lbottom|	:lbo[ttom]	scroll to the bottom of the location window
  |:lbuffer|	:lb[uffer]	parse locations and jump to first location
  |:lcd|		:lc[d]		change directory locally
--- 1707,1712 ----
*** ../vim-8.1.1274/runtime/doc/quickfix.txt	2019-05-04 15:05:24.927269310 +0200
--- runtime/doc/quickfix.txt	2019-05-05 14:56:42.134251046 +0200
***************
*** 152,159 ****
  			exceeds the number of entries below the current line,
  			then the last error in the file is selected.
  
! 							*:lbe* *:lbelow*
! :[count]lbe[low]	Same as ":cbelow", except the location list for the
  			current window is used instead of the quickfix list.
  
  							*:cnf* *:cnfile*
--- 152,187 ----
  			exceeds the number of entries below the current line,
  			then the last error in the file is selected.
  
! 							*:lbel* *:lbelow*
! :[count]lbel[ow]	Same as ":cbelow", except the location list for the
! 			current window is used instead of the quickfix list.
! 
! 							*:cbe* *:cbefore*
! :[count]cbe[fore]	Go to the [count] error before the current cursor
! 			position in the current buffer.  If [count] is
! 			omitted, then 1 is used.  If there are no errors, then
! 			an error message is displayed.  Assumes that the
! 			entries in a quickfix list are sorted by their buffer,
! 			line and column numbers.  If [count] exceeds the
! 			number of entries before the current position, then
! 			the first error in the file is selected.
! 
! 							*:lbef* *:lbefore*
! :[count]lbef[ore]	Same as ":cbefore", except the location list for the
! 			current window is used instead of the quickfix list.
! 
! 							*:caf* *:cafter*
! :[count]caf[ter]	Go to the [count] error after the current cursor
! 			position in the current buffer.  If [count] is
! 			omitted, then 1 is used.  If there are no errors, then
! 			an error message is displayed.  Assumes that the
! 			entries in a quickfix list are sorted by their buffer,
! 			line and column numbers.  If [count] exceeds the
! 			number of entries after the current position, then
! 			the last error in the file is selected.
! 
! 							*:laf* *:lafter*
! :[count]laf[ter]	Same as ":cafter", except the location list for the
  			current window is used instead of the quickfix list.
  
  							*:cnf* *:cnfile*
*** ../vim-8.1.1274/src/ex_cmdidxs.h	2019-05-03 21:56:31.363540578 +0200
--- src/ex_cmdidxs.h	2019-05-05 14:56:42.134251046 +0200
***************
*** 8,36 ****
    /* a */ 0,
    /* b */ 19,
    /* c */ 42,
!   /* d */ 105,
!   /* e */ 127,
!   /* f */ 147,
!   /* g */ 163,
!   /* h */ 169,
!   /* i */ 178,
!   /* j */ 196,
!   /* k */ 198,
!   /* l */ 203,
!   /* m */ 263,
!   /* n */ 281,
!   /* o */ 301,
!   /* p */ 313,
!   /* q */ 352,
!   /* r */ 355,
!   /* s */ 375,
!   /* t */ 443,
!   /* u */ 488,
!   /* v */ 499,
!   /* w */ 517,
!   /* x */ 531,
!   /* y */ 540,
!   /* z */ 541
  };
  
  /*
--- 8,36 ----
    /* a */ 0,
    /* b */ 19,
    /* c */ 42,
!   /* d */ 107,
!   /* e */ 129,
!   /* f */ 149,
!   /* g */ 165,
!   /* h */ 171,
!   /* i */ 180,
!   /* j */ 198,
!   /* k */ 200,
!   /* l */ 205,
!   /* m */ 267,
!   /* n */ 285,
!   /* o */ 305,
!   /* p */ 317,
!   /* q */ 356,
!   /* r */ 359,
!   /* s */ 379,
!   /* t */ 447,
!   /* u */ 492,
!   /* v */ 503,
!   /* w */ 521,
!   /* x */ 535,
!   /* y */ 544,
!   /* z */ 545
  };
  
  /*
***************
*** 43,49 ****
  { /*         a   b   c   d   e   f   g   h   i   j   k   l   m   n   o   p   q   r   s   t   u   v   w   x   y   z */
    /* a */ {  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  5,  6,  0,  0,  0,  7, 15,  0, 16,  0,  0,  0,  0,  0 },
    /* b */ {  2,  0,  0,  4,  5,  7,  0,  0,  0,  0,  0,  8,  9, 10, 11, 12,  0, 13,  0,  0,  0,  0, 22,  0,  0,  0 },
!   /* c */ {  3, 11, 14, 16, 18, 20, 23,  0,  0,  0,  0, 31, 35, 38, 44, 53, 55, 56, 57,  0, 59,  0, 62,  0,  0,  0 },
    /* d */ {  0,  0,  0,  0,  0,  0,  0,  0,  6, 15,  0, 16,  0,  0, 17,  0,  0, 19, 20,  0,  0,  0,  0,  0,  0,  0 },
    /* e */ {  1,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  7,  9, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0, 16,  0,  0 },
    /* f */ {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0, 15,  0,  0,  0,  0,  0 },
--- 43,49 ----
  { /*         a   b   c   d   e   f   g   h   i   j   k   l   m   n   o   p   q   r   s   t   u   v   w   x   y   z */
    /* a */ {  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  5,  6,  0,  0,  0,  7, 15,  0, 16,  0,  0,  0,  0,  0 },
    /* b */ {  2,  0,  0,  4,  5,  7,  0,  0,  0,  0,  0,  8,  9, 10, 11, 12,  0, 13,  0,  0,  0,  0, 22,  0,  0,  0 },
!   /* c */ {  3, 12, 16, 18, 20, 22, 25,  0,  0,  0,  0, 33, 37, 40, 46, 55, 57, 58, 59,  0, 61,  0, 64,  0,  0,  0 },
    /* d */ {  0,  0,  0,  0,  0,  0,  0,  0,  6, 15,  0, 16,  0,  0, 17,  0,  0, 19, 20,  0,  0,  0,  0,  0,  0,  0 },
    /* e */ {  1,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  7,  9, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0, 16,  0,  0 },
    /* f */ {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0, 15,  0,  0,  0,  0,  0 },
***************
*** 52,58 ****
    /* i */ {  1,  0,  0,  0,  0,  3,  0,  0,  0,  4,  0,  5,  6,  0,  0,  0,  0,  0, 13,  0, 15,  0,  0,  0,  0,  0 },
    /* j */ {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0 },
    /* k */ {  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 },
!   /* l */ {  3, 10, 13, 17, 18, 22, 25, 30,  0,  0,  0, 32, 35, 38, 42, 48,  0, 50, 59, 51, 52, 56, 58,  0,  0,  0 },
    /* m */ {  1,  0,  0,  0,  7,  0,  0,  0,  0,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 16 },
    /* n */ {  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  8, 10,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0 },
    /* o */ {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  2,  5,  0,  0,  0,  0,  0,  0,  9,  0, 11,  0,  0,  0 },
--- 52,58 ----
    /* i */ {  1,  0,  0,  0,  0,  3,  0,  0,  0,  4,  0,  5,  6,  0,  0,  0,  0,  0, 13,  0, 15,  0,  0,  0,  0,  0 },
    /* j */ {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0 },
    /* k */ {  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 },
!   /* l */ {  3, 11, 15, 19, 20, 24, 27, 32,  0,  0,  0, 34, 37, 40, 44, 50,  0, 52, 61, 53, 54, 58, 60,  0,  0,  0 },
    /* m */ {  1,  0,  0,  0,  7,  0,  0,  0,  0,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 16 },
    /* n */ {  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  8, 10,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0 },
    /* o */ {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  2,  5,  0,  0,  0,  0,  0,  0,  9,  0, 11,  0,  0,  0 },
***************
*** 69,72 ****
    /* z */ {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 }
  };
  
! static const int command_count = 554;
--- 69,72 ----
    /* z */ {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 }
  };
  
! static const int command_count = 558;
*** ../vim-8.1.1274/src/ex_cmds.h	2019-05-04 15:05:24.927269310 +0200
--- src/ex_cmds.h	2019-05-05 14:56:42.134251046 +0200
***************
*** 266,271 ****
--- 266,274 ----
  EX(CMD_caddfile,	"caddfile",	ex_cfile,
  			TRLBAR|FILE1,
  			ADDR_NONE),
+ EX(CMD_cafter,		"cafter",	ex_cbelow,
+ 			RANGE|COUNT|TRLBAR,
+ 			ADDR_UNSIGNED),
  EX(CMD_call,		"call",		ex_call,
  			RANGE|NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN,
  			ADDR_LINES),
***************
*** 275,280 ****
--- 278,286 ----
  EX(CMD_cbuffer,		"cbuffer",	ex_cbuffer,
  			BANG|RANGE|WORD1|TRLBAR,
  			ADDR_OTHER),
+ EX(CMD_cbefore,		"cbefore",	ex_cbelow,
+ 			RANGE|COUNT|TRLBAR,
+ 			ADDR_UNSIGNED),
  EX(CMD_cbelow,		"cbelow",	ex_cbelow,
  			RANGE|COUNT|TRLBAR,
  			ADDR_UNSIGNED),
***************
*** 749,760 ****
--- 755,772 ----
  EX(CMD_laddfile,	"laddfile",	ex_cfile,
  			TRLBAR|FILE1,
  			ADDR_NONE),
+ EX(CMD_lafter,		"lafter",	ex_cbelow,
+ 			RANGE|COUNT|TRLBAR,
+ 			ADDR_UNSIGNED),
  EX(CMD_later,		"later",	ex_later,
  			TRLBAR|EXTRA|NOSPC|CMDWIN,
  			ADDR_NONE),
  EX(CMD_lbuffer,		"lbuffer",	ex_cbuffer,
  			BANG|RANGE|WORD1|TRLBAR,
  			ADDR_OTHER),
+ EX(CMD_lbefore,		"lbefore",	ex_cbelow,
+ 			RANGE|COUNT|TRLBAR,
+ 			ADDR_UNSIGNED),
  EX(CMD_lbelow,		"lbelow",	ex_cbelow,
  			RANGE|COUNT|TRLBAR,
  			ADDR_UNSIGNED),
*** ../vim-8.1.1274/src/quickfix.c	2019-05-04 15:05:24.927269310 +0200
--- src/quickfix.c	2019-05-05 14:56:42.138251022 +0200
***************
*** 5128,5163 ****
  }
  
  /*
!  * Find the first quickfix entry below line 'lnum' in buffer 'bnr'.
   * 'qfp' points to the very first entry in the buffer and 'errornr' is the
   * index of the very first entry in the quickfix list.
!  * Returns NULL if an entry is not found after 'lnum'.
   */
      static qfline_T *
! qf_find_entry_on_next_line(
  	int		bnr,
! 	linenr_T	lnum,
  	qfline_T	*qfp,
  	int		*errornr)
  {
!     if (qfp->qf_lnum > lnum)
! 	// First entry is after line 'lnum'
  	return qfp;
  
!     // Find the entry just before or at the line 'lnum'
      while (qfp->qf_next != NULL
  	    && qfp->qf_next->qf_fnum == bnr
! 	    && qfp->qf_next->qf_lnum <= lnum)
      {
  	qfp = qfp->qf_next;
  	++*errornr;
      }
  
      if (qfp->qf_next == NULL || qfp->qf_next->qf_fnum != bnr)
! 	// No entries found after 'lnum'
  	return NULL;
  
!     // Use the entry just after line 'lnum'
      qfp = qfp->qf_next;
      ++*errornr;
  
--- 5128,5227 ----
  }
  
  /*
!  * Returns TRUE if the specified quickfix entry is
!  *   after the given line (linewise is TRUE)
!  *   or after the line and column.
!  */
!     static int
! qf_entry_after_pos(qfline_T *qfp, pos_T *pos, int linewise)
! {
!     if (linewise)
! 	return qfp->qf_lnum > pos->lnum;
!     else
! 	return (qfp->qf_lnum > pos->lnum ||
! 		(qfp->qf_lnum == pos->lnum && qfp->qf_col > pos->col));
! }
! 
! /*
!  * Returns TRUE if the specified quickfix entry is
!  *   before the given line (linewise is TRUE)
!  *   or before the line and column.
!  */
!     static int
! qf_entry_before_pos(qfline_T *qfp, pos_T *pos, int linewise)
! {
!     if (linewise)
! 	return qfp->qf_lnum < pos->lnum;
!     else
! 	return (qfp->qf_lnum < pos->lnum ||
! 		(qfp->qf_lnum == pos->lnum && qfp->qf_col < pos->col));
! }
! 
! /*
!  * Returns TRUE if the specified quickfix entry is
!  *   on or after the given line (linewise is TRUE)
!  *   or on or after the line and column.
!  */
!     static int
! qf_entry_on_or_after_pos(qfline_T *qfp, pos_T *pos, int linewise)
! {
!     if (linewise)
! 	return qfp->qf_lnum >= pos->lnum;
!     else
! 	return (qfp->qf_lnum > pos->lnum ||
! 		(qfp->qf_lnum == pos->lnum && qfp->qf_col >= pos->col));
! }
! 
! /*
!  * Returns TRUE if the specified quickfix entry is
!  *   on or before the given line (linewise is TRUE)
!  *   or on or before the line and column.
!  */
!     static int
! qf_entry_on_or_before_pos(qfline_T *qfp, pos_T *pos, int linewise)
! {
!     if (linewise)
! 	return qfp->qf_lnum <= pos->lnum;
!     else
! 	return (qfp->qf_lnum < pos->lnum ||
! 		(qfp->qf_lnum == pos->lnum && qfp->qf_col <= pos->col));
! }
! 
! /*
!  * Find the first quickfix entry after position 'pos' in buffer 'bnr'.
!  * If 'linewise' is TRUE, returns the entry after the specified line and treats
!  * multiple entries on a single line as one. Otherwise returns the entry after
!  * the specified line and column.
   * 'qfp' points to the very first entry in the buffer and 'errornr' is the
   * index of the very first entry in the quickfix list.
!  * Returns NULL if an entry is not found after 'pos'.
   */
      static qfline_T *
! qf_find_entry_after_pos(
  	int		bnr,
! 	pos_T		*pos,
! 	int		linewise,
  	qfline_T	*qfp,
  	int		*errornr)
  {
!     if (qf_entry_after_pos(qfp, pos, linewise))
! 	// First entry is after postion 'pos'
  	return qfp;
  
!     // Find the entry just before or at the position 'pos'
      while (qfp->qf_next != NULL
  	    && qfp->qf_next->qf_fnum == bnr
! 	    && qf_entry_on_or_before_pos(qfp->qf_next, pos, linewise))
      {
  	qfp = qfp->qf_next;
  	++*errornr;
      }
  
      if (qfp->qf_next == NULL || qfp->qf_next->qf_fnum != bnr)
! 	// No entries found after position 'pos'
  	return NULL;
  
!     // Use the entry just after position 'pos'
      qfp = qfp->qf_next;
      ++*errornr;
  
***************
*** 5165,5210 ****
  }
  
  /*
!  * Find the first quickfix entry before line 'lnum' in buffer 'bnr'.
   * 'qfp' points to the very first entry in the buffer and 'errornr' is the
   * index of the very first entry in the quickfix list.
!  * Returns NULL if an entry is not found before 'lnum'.
   */
      static qfline_T *
! qf_find_entry_on_prev_line(
  	int		bnr,
! 	linenr_T	lnum,
  	qfline_T	*qfp,
  	int		*errornr)
  {
!     // Find the entry just before the line 'lnum'
      while (qfp->qf_next != NULL
  	    && qfp->qf_next->qf_fnum == bnr
! 	    && qfp->qf_next->qf_lnum < lnum)
      {
  	qfp = qfp->qf_next;
  	++*errornr;
      }
  
!     if (qfp->qf_lnum >= lnum)	// entry is after 'lnum'
  	return NULL;
  
!     // If multiple entries are on the same line, then use the first entry
!     qfp = qf_find_first_entry_on_line(qfp, errornr);
  
      return qfp;
  }
  
  /*
!  * Find a quickfix entry in 'qfl' closest to line 'lnum' in buffer 'bnr' in
   * the direction 'dir'.
   */
      static qfline_T *
  qf_find_closest_entry(
  	qf_list_T	*qfl,
  	int		bnr,
! 	linenr_T	lnum,
  	int		dir,
  	int		*errornr)
  {
      qfline_T	*qfp;
--- 5229,5280 ----
  }
  
  /*
!  * Find the first quickfix entry before position 'pos' in buffer 'bnr'.
!  * If 'linewise' is TRUE, returns the entry before the specified line and
!  * treats multiple entries on a single line as one. Otherwise returns the entry
!  * before the specified line and column.
   * 'qfp' points to the very first entry in the buffer and 'errornr' is the
   * index of the very first entry in the quickfix list.
!  * Returns NULL if an entry is not found before 'pos'.
   */
      static qfline_T *
! qf_find_entry_before_pos(
  	int		bnr,
! 	pos_T		*pos,
! 	int		linewise,
  	qfline_T	*qfp,
  	int		*errornr)
  {
!     // Find the entry just before the position 'pos'
      while (qfp->qf_next != NULL
  	    && qfp->qf_next->qf_fnum == bnr
! 	    && qf_entry_before_pos(qfp->qf_next, pos, linewise))
      {
  	qfp = qfp->qf_next;
  	++*errornr;
      }
  
!     if (qf_entry_on_or_after_pos(qfp, pos, linewise))
  	return NULL;
  
!     if (linewise)
! 	// If multiple entries are on the same line, then use the first entry
! 	qfp = qf_find_first_entry_on_line(qfp, errornr);
  
      return qfp;
  }
  
  /*
!  * Find a quickfix entry in 'qfl' closest to position 'pos' in buffer 'bnr' in
   * the direction 'dir'.
   */
      static qfline_T *
  qf_find_closest_entry(
  	qf_list_T	*qfl,
  	int		bnr,
! 	pos_T		*pos,
  	int		dir,
+ 	int		linewise,
  	int		*errornr)
  {
      qfline_T	*qfp;
***************
*** 5217,5251 ****
  	return NULL;		// no entry in this file
  
      if (dir == FORWARD)
! 	qfp = qf_find_entry_on_next_line(bnr, lnum, qfp, errornr);
      else
! 	qfp = qf_find_entry_on_prev_line(bnr, lnum, qfp, errornr);
  
      return qfp;
  }
  
  /*
!  * Get the nth quickfix entry below the specified entry treating multiple
!  * entries on a single line as one. Searches forward in the list.
   */
      static qfline_T *
! qf_get_nth_below_entry(qfline_T *entry, int *errornr, int n)
  {
      while (n-- > 0 && !got_int)
      {
  	qfline_T	*first_entry = entry;
  	int		first_errornr = *errornr;
  
! 	// Treat all the entries on the same line in this file as one
! 	entry = qf_find_last_entry_on_line(entry, errornr);
  
  	if (entry->qf_next == NULL
  		|| entry->qf_next->qf_fnum != entry->qf_fnum)
  	{
! 	    // If multiple entries are on the same line, then use the first
! 	    // entry
! 	    entry = first_entry;
! 	    *errornr = first_errornr;
  	    break;
  	}
  
--- 5287,5326 ----
  	return NULL;		// no entry in this file
  
      if (dir == FORWARD)
! 	qfp = qf_find_entry_after_pos(bnr, pos, linewise, qfp, errornr);
      else
! 	qfp = qf_find_entry_before_pos(bnr, pos, linewise, qfp, errornr);
  
      return qfp;
  }
  
  /*
!  * Get the nth quickfix entry below the specified entry.  Searches forward in
!  * the list. If linewise is TRUE, then treat multiple entries on a single line
!  * as one.
   */
      static qfline_T *
! qf_get_nth_below_entry(qfline_T *entry, int n, int linewise, int *errornr)
  {
      while (n-- > 0 && !got_int)
      {
  	qfline_T	*first_entry = entry;
  	int		first_errornr = *errornr;
  
! 	if (linewise)
! 	    // Treat all the entries on the same line in this file as one
! 	    entry = qf_find_last_entry_on_line(entry, errornr);
  
  	if (entry->qf_next == NULL
  		|| entry->qf_next->qf_fnum != entry->qf_fnum)
  	{
! 	    if (linewise)
! 	    {
! 		// If multiple entries are on the same line, then use the first
! 		// entry
! 		entry = first_entry;
! 		*errornr = first_errornr;
! 	    }
  	    break;
  	}
  
***************
*** 5257,5267 ****
  }
  
  /*
!  * Get the nth quickfix entry above the specified entry treating multiple
!  * entries on a single line as one. Searches backwards in the list.
   */
      static qfline_T *
! qf_get_nth_above_entry(qfline_T *entry, int *errornr, int n)
  {
      while (n-- > 0 && !got_int)
      {
--- 5332,5343 ----
  }
  
  /*
!  * Get the nth quickfix entry above the specified entry.  Searches backwards in
!  * the list. If linewise is TRUE, then treat multiple entries on a single line
!  * as one.
   */
      static qfline_T *
! qf_get_nth_above_entry(qfline_T *entry, int n, int linewise, int *errornr)
  {
      while (n-- > 0 && !got_int)
      {
***************
*** 5273,5297 ****
  	--*errornr;
  
  	// If multiple entries are on the same line, then use the first entry
! 	entry = qf_find_first_entry_on_line(entry, errornr);
      }
  
      return entry;
  }
  
  /*
!  * Find the n'th quickfix entry adjacent to line 'lnum' in buffer 'bnr' in the
!  * specified direction.
!  * Returns the error number in the quickfix list or 0 if an entry is not found.
   */
      static int
! qf_find_nth_adj_entry(qf_list_T *qfl, int bnr, linenr_T lnum, int n, int dir)
  {
      qfline_T	*adj_entry;
      int		errornr;
  
!     // Find an entry closest to the specified line
!     adj_entry = qf_find_closest_entry(qfl, bnr, lnum, dir, &errornr);
      if (adj_entry == NULL)
  	return 0;
  
--- 5349,5380 ----
  	--*errornr;
  
  	// If multiple entries are on the same line, then use the first entry
! 	if (linewise)
! 	    entry = qf_find_first_entry_on_line(entry, errornr);
      }
  
      return entry;
  }
  
  /*
!  * Find the n'th quickfix entry adjacent to position 'pos' in buffer 'bnr' in
!  * the specified direction.  Returns the error number in the quickfix list or 0
!  * if an entry is not found.
   */
      static int
! qf_find_nth_adj_entry(
! 	qf_list_T	*qfl,
! 	int		bnr,
! 	pos_T		*pos,
! 	int		n,
! 	int		dir,
! 	int		linewise)
  {
      qfline_T	*adj_entry;
      int		errornr;
  
!     // Find an entry closest to the specified position
!     adj_entry = qf_find_closest_entry(qfl, bnr, pos, dir, linewise, &errornr);
      if (adj_entry == NULL)
  	return 0;
  
***************
*** 5299,5315 ****
      {
  	// Go to the n'th entry in the current buffer
  	if (dir == FORWARD)
! 	    adj_entry = qf_get_nth_below_entry(adj_entry, &errornr, n);
  	else
! 	    adj_entry = qf_get_nth_above_entry(adj_entry, &errornr, n);
      }
  
      return errornr;
  }
  
  /*
!  * Jump to a quickfix entry in the current file nearest to the current line.
!  * ":cabove", ":cbelow", ":labove" and ":lbelow" commands
   */
      void
  ex_cbelow(exarg_T *eap)
--- 5382,5402 ----
      {
  	// Go to the n'th entry in the current buffer
  	if (dir == FORWARD)
! 	    adj_entry = qf_get_nth_below_entry(adj_entry, n, linewise,
! 		    &errornr);
  	else
! 	    adj_entry = qf_get_nth_above_entry(adj_entry, n, linewise,
! 		    &errornr);
      }
  
      return errornr;
  }
  
  /*
!  * Jump to a quickfix entry in the current file nearest to the current line or
!  * current line/col.
!  * ":cabove", ":cbelow", ":labove", ":lbelow", ":cafter", ":cbefore",
!  * ":lafter" and ":lbefore" commands
   */
      void
  ex_cbelow(exarg_T *eap)
***************
*** 5319,5324 ****
--- 5406,5412 ----
      int		dir;
      int		buf_has_flag;
      int		errornr = 0;
+     pos_T	pos;
  
      if (eap->addr_count > 0 && eap->line2 <= 0)
      {
***************
*** 5327,5333 ****
      }
  
      // Check whether the current buffer has any quickfix entries
!     if (eap->cmdidx == CMD_cabove || eap->cmdidx == CMD_cbelow)
  	buf_has_flag = BUF_HAS_QF_ENTRY;
      else
  	buf_has_flag = BUF_HAS_LL_ENTRY;
--- 5415,5422 ----
      }
  
      // Check whether the current buffer has any quickfix entries
!     if (eap->cmdidx == CMD_cabove || eap->cmdidx == CMD_cbelow
! 	    || eap->cmdidx == CMD_cbefore || eap->cmdidx == CMD_cafter)
  	buf_has_flag = BUF_HAS_QF_ENTRY;
      else
  	buf_has_flag = BUF_HAS_LL_ENTRY;
***************
*** 5348,5360 ****
  	return;
      }
  
!     if (eap->cmdidx == CMD_cbelow || eap->cmdidx == CMD_lbelow)
  	dir = FORWARD;
      else
  	dir = BACKWARD;
  
!     errornr = qf_find_nth_adj_entry(qfl, curbuf->b_fnum, curwin->w_cursor.lnum,
! 	    eap->addr_count > 0 ? eap->line2 : 0, dir);
  
      if (errornr > 0)
  	qf_jump(qi, 0, errornr, FALSE);
--- 5437,5461 ----
  	return;
      }
  
!     if (eap->cmdidx == CMD_cbelow
! 	    || eap->cmdidx == CMD_lbelow
! 	    || eap->cmdidx == CMD_cafter
! 	    || eap->cmdidx == CMD_lafter)
! 	// Forward motion commands
  	dir = FORWARD;
      else
  	dir = BACKWARD;
  
!     pos = curwin->w_cursor;
!     // A quickfix entry column number is 1 based whereas cursor column
!     // number is 0 based. Adjust the column number.
!     pos.col++;
!     errornr = qf_find_nth_adj_entry(qfl, curbuf->b_fnum, &pos,
! 				eap->addr_count > 0 ? eap->line2 : 0, dir,
! 				eap->cmdidx == CMD_cbelow
! 					|| eap->cmdidx == CMD_lbelow
! 					|| eap->cmdidx == CMD_cabove
! 					|| eap->cmdidx == CMD_labove);
  
      if (errornr > 0)
  	qf_jump(qi, 0, errornr, FALSE);
*** ../vim-8.1.1274/src/testdir/test_quickfix.vim	2019-05-04 15:05:24.927269310 +0200
--- src/testdir/test_quickfix.vim	2019-05-05 14:56:42.138251022 +0200
***************
*** 39,44 ****
--- 39,46 ----
      command! -nargs=0 -count Xcc <count>cc
      command! -count=1 -nargs=0 Xbelow <mods><count>cbelow
      command! -count=1 -nargs=0 Xabove <mods><count>cabove
+     command! -count=1 -nargs=0 Xbefore <mods><count>cbefore
+     command! -count=1 -nargs=0 Xafter <mods><count>cafter
      let g:Xgetlist = function('getqflist')
      let g:Xsetlist = function('setqflist')
      call setqflist([], 'f')
***************
*** 74,79 ****
--- 76,83 ----
      command! -nargs=0 -count Xcc <count>ll
      command! -count=1 -nargs=0 Xbelow <mods><count>lbelow
      command! -count=1 -nargs=0 Xabove <mods><count>labove
+     command! -count=1 -nargs=0 Xbefore <mods><count>lbefore
+     command! -count=1 -nargs=0 Xafter <mods><count>lafter
      let g:Xgetlist = function('getloclist', [0])
      let g:Xsetlist = function('setloclist', [0])
      call setloclist(0, [], 'f')
***************
*** 4041,4057 ****
--- 4045,4066 ----
  endfunc
  
  " Test for the :cbelow, :cabove, :lbelow and :labove commands.
+ " And for the :cafter, :cbefore, :lafter and :lbefore commands.
  func Xtest_below(cchar)
    call s:setup_commands(a:cchar)
  
    " No quickfix/location list
    call assert_fails('Xbelow', 'E42:')
    call assert_fails('Xabove', 'E42:')
+   call assert_fails('Xbefore', 'E42:')
+   call assert_fails('Xafter', 'E42:')
  
    " Empty quickfix/location list
    call g:Xsetlist([])
    call assert_fails('Xbelow', 'E42:')
    call assert_fails('Xabove', 'E42:')
+   call assert_fails('Xbefore', 'E42:')
+   call assert_fails('Xafter', 'E42:')
  
    call s:create_test_file('X1')
    call s:create_test_file('X2')
***************
*** 4065,4103 ****
    call assert_fails('Xabove', 'E42:')
    call assert_fails('3Xbelow', 'E42:')
    call assert_fails('4Xabove', 'E42:')
  
    " Test the commands with various arguments
!   Xexpr ["X1:5:L5", "X2:5:L5", "X2:10:L10", "X2:15:L15", "X3:3:L3"]
    edit +7 X2
    Xabove
    call assert_equal(['X2', 5], [bufname(''), line('.')])
    call assert_fails('Xabove', 'E553:')
    normal 2j
    Xbelow
    call assert_equal(['X2', 10], [bufname(''), line('.')])
    " Last error in this file
    Xbelow 99
    call assert_equal(['X2', 15], [bufname(''), line('.')])
    call assert_fails('Xbelow', 'E553:')
    " First error in this file
    Xabove 99
    call assert_equal(['X2', 5], [bufname(''), line('.')])
    call assert_fails('Xabove', 'E553:')
    normal gg
    Xbelow 2
    call assert_equal(['X2', 10], [bufname(''), line('.')])
    normal G
    Xabove 2
    call assert_equal(['X2', 10], [bufname(''), line('.')])
    edit X4
    call assert_fails('Xabove', 'E42:')
    call assert_fails('Xbelow', 'E42:')
    if a:cchar == 'l'
      " If a buffer has location list entries from some other window but not
      " from the current window, then the commands should fail.
      edit X1 | split | call setloclist(0, [], 'f')
      call assert_fails('Xabove', 'E776:')
      call assert_fails('Xbelow', 'E776:')
      close
    endif
  
--- 4074,4147 ----
    call assert_fails('Xabove', 'E42:')
    call assert_fails('3Xbelow', 'E42:')
    call assert_fails('4Xabove', 'E42:')
+   call assert_fails('Xbefore', 'E42:')
+   call assert_fails('Xafter', 'E42:')
+   call assert_fails('3Xbefore', 'E42:')
+   call assert_fails('4Xafter', 'E42:')
  
    " Test the commands with various arguments
!   Xexpr ["X1:5:3:L5", "X2:5:2:L5", "X2:10:3:L10", "X2:15:4:L15", "X3:3:5:L3"]
    edit +7 X2
    Xabove
    call assert_equal(['X2', 5], [bufname(''), line('.')])
    call assert_fails('Xabove', 'E553:')
+   normal 7G
+   Xbefore
+   call assert_equal(['X2', 5, 2], [bufname(''), line('.'), col('.')])
+   call assert_fails('Xbefore', 'E553:')
+ 
    normal 2j
    Xbelow
    call assert_equal(['X2', 10], [bufname(''), line('.')])
+   normal 7G
+   Xafter
+   call assert_equal(['X2', 10, 3], [bufname(''), line('.'), col('.')])
+ 
    " Last error in this file
    Xbelow 99
    call assert_equal(['X2', 15], [bufname(''), line('.')])
    call assert_fails('Xbelow', 'E553:')
+   normal gg
+   Xafter 99
+   call assert_equal(['X2', 15, 4], [bufname(''), line('.'), col('.')])
+   call assert_fails('Xafter', 'E553:')
+ 
    " First error in this file
    Xabove 99
    call assert_equal(['X2', 5], [bufname(''), line('.')])
    call assert_fails('Xabove', 'E553:')
+   normal G
+   Xbefore 99
+   call assert_equal(['X2', 5, 2], [bufname(''), line('.'), col('.')])
+   call assert_fails('Xbefore', 'E553:')
+ 
    normal gg
    Xbelow 2
    call assert_equal(['X2', 10], [bufname(''), line('.')])
+   normal gg
+   Xafter 2
+   call assert_equal(['X2', 10, 3], [bufname(''), line('.'), col('.')])
+ 
    normal G
    Xabove 2
    call assert_equal(['X2', 10], [bufname(''), line('.')])
+   normal G
+   Xbefore 2
+   call assert_equal(['X2', 10, 3], [bufname(''), line('.'), col('.')])
+ 
    edit X4
    call assert_fails('Xabove', 'E42:')
    call assert_fails('Xbelow', 'E42:')
+   call assert_fails('Xbefore', 'E42:')
+   call assert_fails('Xafter', 'E42:')
    if a:cchar == 'l'
      " If a buffer has location list entries from some other window but not
      " from the current window, then the commands should fail.
      edit X1 | split | call setloclist(0, [], 'f')
      call assert_fails('Xabove', 'E776:')
      call assert_fails('Xbelow', 'E776:')
+     call assert_fails('Xbefore', 'E776:')
+     call assert_fails('Xafter', 'E776:')
      close
    endif
  
***************
*** 4108,4134 ****
--- 4152,4203 ----
    edit +1 X2
    Xbelow 2
    call assert_equal(['X2', 10, 1], [bufname(''), line('.'), col('.')])
+   normal 1G
+   Xafter 2
+   call assert_equal(['X2', 5, 2], [bufname(''), line('.'), col('.')])
+ 
    normal gg
    Xbelow 99
    call assert_equal(['X2', 15, 1], [bufname(''), line('.'), col('.')])
+   normal gg
+   Xafter 99
+   call assert_equal(['X2', 15, 3], [bufname(''), line('.'), col('.')])
+ 
    normal G
    Xabove 2
    call assert_equal(['X2', 10, 1], [bufname(''), line('.'), col('.')])
    normal G
+   Xbefore 2
+   call assert_equal(['X2', 15, 2], [bufname(''), line('.'), col('.')])
+ 
+   normal G
    Xabove 99
    call assert_equal(['X2', 5, 1], [bufname(''), line('.'), col('.')])
+   normal G
+   Xbefore 99
+   call assert_equal(['X2', 5, 1], [bufname(''), line('.'), col('.')])
+ 
    normal 10G
    Xabove
    call assert_equal(['X2', 5, 1], [bufname(''), line('.'), col('.')])
+   normal 10G$
+   2Xbefore
+   call assert_equal(['X2', 10, 2], [bufname(''), line('.'), col('.')])
+ 
    normal 10G
    Xbelow
    call assert_equal(['X2', 15, 1], [bufname(''), line('.'), col('.')])
+   normal 9G
+   5Xafter
+   call assert_equal(['X2', 15, 2], [bufname(''), line('.'), col('.')])
  
    " Invalid range
    if a:cchar == 'c'
      call assert_fails('-2cbelow', 'E16:')
+     call assert_fails('-2cafter', 'E16:')
    else
      call assert_fails('-2lbelow', 'E16:')
+     call assert_fails('-2lafter', 'E16:')
    endif
  
    call delete('X1')
*** ../vim-8.1.1274/src/version.c	2019-05-05 14:19:17.594303166 +0200
--- src/version.c	2019-05-05 14:58:18.513708487 +0200
***************
*** 769,770 ****
--- 769,772 ----
  {   /* Add new patch number below this line */
+ /**/
+     1275,
  /**/

-- 
Permission is granted to read this message out aloud on Kings Cross Road,
London, under the condition that the orator is properly dressed.

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