summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0514
blob: 497516db957ecafd96f62b3188f3d6deeb449dde (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
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0514
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.0514
Problem:    CTRL-W ^ does not work when alternate buffer has no name.
Solution:   Use another method to split and edit the alternate buffer. (Jason
            Franklin)
Files:	    src/testdir/test_normal.vim, src/testdir/test_window_cmd.vim,
            src/normal.c, src/window.c, runtime/doc/windows.txt


*** ../vim-8.1.0513/src/testdir/test_normal.vim	2018-09-03 22:08:05.676736128 +0200
--- src/testdir/test_normal.vim	2018-11-10 15:55:36.238319451 +0100
***************
*** 1,11 ****
  " Test for various Normal mode commands
  
! func! Setup_NewWindow()
    10new
    call setline(1, range(1,100))
  endfunc
  
! func! MyFormatExpr()
    " Adds '->$' at lines having numbers followed by trailing whitespace
    for ln in range(v:lnum, v:lnum+v:count-1)
      let line = getline(ln)
--- 1,11 ----
  " Test for various Normal mode commands
  
! func Setup_NewWindow()
    10new
    call setline(1, range(1,100))
  endfunc
  
! func MyFormatExpr()
    " Adds '->$' at lines having numbers followed by trailing whitespace
    for ln in range(v:lnum, v:lnum+v:count-1)
      let line = getline(ln)
***************
*** 15,21 ****
    endfor
  endfunc
  
! func! CountSpaces(type, ...)
    " for testing operatorfunc
    " will count the number of spaces
    " and return the result in g:a
--- 15,21 ----
    endfor
  endfunc
  
! func CountSpaces(type, ...)
    " for testing operatorfunc
    " will count the number of spaces
    " and return the result in g:a
***************
*** 35,41 ****
    let @@ = reg_save
  endfunc
  
! func! OpfuncDummy(type, ...)
    " for testing operatorfunc
    let g:opt=&linebreak
  
--- 35,41 ----
    let @@ = reg_save
  endfunc
  
! func OpfuncDummy(type, ...)
    " for testing operatorfunc
    let g:opt=&linebreak
  
***************
*** 78,84 ****
    bw!
  endfunc
  
! func! Test_normal01_keymodel()
    call Setup_NewWindow()
    " Test 1: depending on 'keymodel' <s-down> does something different
    50
--- 78,84 ----
    bw!
  endfunc
  
! func Test_normal01_keymodel()
    call Setup_NewWindow()
    " Test 1: depending on 'keymodel' <s-down> does something different
    50
***************
*** 112,118 ****
    bw!
  endfunc
  
! func! Test_normal02_selectmode()
    " some basic select mode tests
    call Setup_NewWindow()
    50
--- 112,118 ----
    bw!
  endfunc
  
! func Test_normal02_selectmode()
    " some basic select mode tests
    call Setup_NewWindow()
    50
***************
*** 126,132 ****
    bw!
  endfunc
  
! func! Test_normal02_selectmode2()
    " some basic select mode tests
    call Setup_NewWindow()
    50
--- 126,132 ----
    bw!
  endfunc
  
! func Test_normal02_selectmode2()
    " some basic select mode tests
    call Setup_NewWindow()
    50
***************
*** 136,142 ****
    bw!
  endfunc
  
! func! Test_normal03_join()
    " basic join test
    call Setup_NewWindow()
    50
--- 136,142 ----
    bw!
  endfunc
  
! func Test_normal03_join()
    " basic join test
    call Setup_NewWindow()
    50
***************
*** 156,162 ****
    bw!
  endfunc
  
! func! Test_normal04_filter()
    " basic filter test
    " only test on non windows platform
    if has('win32')
--- 156,162 ----
    bw!
  endfunc
  
! func Test_normal04_filter()
    " basic filter test
    " only test on non windows platform
    if has('win32')
***************
*** 182,188 ****
    bw!
  endfunc
  
! func! Test_normal05_formatexpr()
    " basic formatexpr test
    call Setup_NewWindow()
    %d_
--- 182,188 ----
    bw!
  endfunc
  
! func Test_normal05_formatexpr()
    " basic formatexpr test
    call Setup_NewWindow()
    %d_
***************
*** 219,225 ****
    set formatexpr=
  endfunc
  
! func! Test_normal06_formatprg()
    " basic test for formatprg
    " only test on non windows platform
    if has('win32')
--- 219,225 ----
    set formatexpr=
  endfunc
  
! func Test_normal06_formatprg()
    " basic test for formatprg
    " only test on non windows platform
    if has('win32')
***************
*** 253,259 ****
    call delete('Xsed_format.sh')
  endfunc
  
! func! Test_normal07_internalfmt()
    " basic test for internal formmatter to textwidth of 12
    let list=range(1,11)
    call map(list, 'v:val."    "')
--- 253,259 ----
    call delete('Xsed_format.sh')
  endfunc
  
! func Test_normal07_internalfmt()
    " basic test for internal formmatter to textwidth of 12
    let list=range(1,11)
    call map(list, 'v:val."    "')
***************
*** 267,273 ****
    bw!
  endfunc
  
! func! Test_normal08_fold()
    " basic tests for foldopen/folddelete
    if !has("folding")
      return
--- 267,273 ----
    bw!
  endfunc
  
! func Test_normal08_fold()
    " basic tests for foldopen/folddelete
    if !has("folding")
      return
***************
*** 326,332 ****
    bw!
  endfunc
  
! func! Test_normal09_operatorfunc()
    " Test operatorfunc
    call Setup_NewWindow()
    " Add some spaces for counting
--- 326,332 ----
    bw!
  endfunc
  
! func Test_normal09_operatorfunc()
    " Test operatorfunc
    call Setup_NewWindow()
    " Add some spaces for counting
***************
*** 356,362 ****
    bw!
  endfunc
  
! func! Test_normal09a_operatorfunc()
    " Test operatorfunc
    call Setup_NewWindow()
    " Add some spaces for counting
--- 356,362 ----
    bw!
  endfunc
  
! func Test_normal09a_operatorfunc()
    " Test operatorfunc
    call Setup_NewWindow()
    " Add some spaces for counting
***************
*** 382,388 ****
    unlet! g:opt
  endfunc
  
! func! Test_normal10_expand()
    " Test for expand()
    10new
    call setline(1, ['1', 'ifooar,,cbar'])
--- 382,388 ----
    unlet! g:opt
  endfunc
  
! func Test_normal10_expand()
    " Test for expand()
    10new
    call setline(1, ['1', 'ifooar,,cbar'])
***************
*** 417,423 ****
    bw!
  endfunc
  
! func! Test_normal11_showcmd()
    " test for 'showcmd'
    10new
    exe "norm! ofoobar\<esc>"
--- 417,423 ----
    bw!
  endfunc
  
! func Test_normal11_showcmd()
    " test for 'showcmd'
    10new
    exe "norm! ofoobar\<esc>"
***************
*** 432,438 ****
    bw!
  endfunc
  
! func! Test_normal12_nv_error()
    " Test for nv_error
    10new
    call setline(1, range(1,5))
--- 432,438 ----
    bw!
  endfunc
  
! func Test_normal12_nv_error()
    " Test for nv_error
    10new
    call setline(1, range(1,5))
***************
*** 442,448 ****
    bw!
  endfunc
  
! func! Test_normal13_help()
    " Test for F1
    call assert_equal(1, winnr())
    call feedkeys("\<f1>", 'txi')
--- 442,448 ----
    bw!
  endfunc
  
! func Test_normal13_help()
    " Test for F1
    call assert_equal(1, winnr())
    call feedkeys("\<f1>", 'txi')
***************
*** 451,457 ****
    bw!
  endfunc
  
! func! Test_normal14_page()
    " basic test for Ctrl-F and Ctrl-B
    call Setup_NewWindow()
    exe "norm! \<c-f>"
--- 451,457 ----
    bw!
  endfunc
  
! func Test_normal14_page()
    " basic test for Ctrl-F and Ctrl-B
    call Setup_NewWindow()
    exe "norm! \<c-f>"
***************
*** 485,491 ****
    bw!
  endfunc
  
! func! Test_normal14_page_eol()
    10new
    norm oxxxxxxx
    exe "norm 2\<c-f>"
--- 485,491 ----
    bw!
  endfunc
  
! func Test_normal14_page_eol()
    10new
    norm oxxxxxxx
    exe "norm 2\<c-f>"
***************
*** 494,500 ****
    bw!
  endfunc
  
! func! Test_normal15_z_scroll_vert()
    " basic test for z commands that scroll the window
    call Setup_NewWindow()
    100
--- 494,500 ----
    bw!
  endfunc
  
! func Test_normal15_z_scroll_vert()
    " basic test for z commands that scroll the window
    call Setup_NewWindow()
    100
***************
*** 583,589 ****
    bw!
  endfunc
  
! func! Test_normal16_z_scroll_hor()
    " basic test for z commands that scroll the window
    10new
    15vsp
--- 583,589 ----
    bw!
  endfunc
  
! func Test_normal16_z_scroll_hor()
    " basic test for z commands that scroll the window
    10new
    15vsp
***************
*** 649,655 ****
    bw!
  endfunc
  
! func! Test_normal17_z_scroll_hor2()
    " basic test for z commands that scroll the window
    " using 'sidescrolloff' setting
    10new
--- 649,655 ----
    bw!
  endfunc
  
! func Test_normal17_z_scroll_hor2()
    " basic test for z commands that scroll the window
    " using 'sidescrolloff' setting
    10new
***************
*** 716,722 ****
    bw!
  endfunc
  
! func! Test_normal18_z_fold()
    " basic tests for foldopen/folddelete
    if !has("folding")
      return
--- 716,722 ----
    bw!
  endfunc
  
! func Test_normal18_z_fold()
    " basic tests for foldopen/folddelete
    if !has("folding")
      return
***************
*** 1087,1093 ****
    bw!
  endfunc
  
! func! Test_normal19_z_spell()
    if !has("spell") || !has('syntax')
      return
    endif
--- 1087,1093 ----
    bw!
  endfunc
  
! func Test_normal19_z_spell()
    if !has("spell") || !has('syntax')
      return
    endif
***************
*** 1241,1247 ****
    bw!
  endfunc
  
! func! Test_normal20_exmode()
    if !has("unix")
      " Reading from redirected file doesn't work on MS-Windows
      return
--- 1241,1247 ----
    bw!
  endfunc
  
! func Test_normal20_exmode()
    if !has("unix")
      " Reading from redirected file doesn't work on MS-Windows
      return
***************
*** 1259,1282 ****
    bw!
  endfunc
  
! func! Test_normal21_nv_hat()
!   set hidden
!   new
!   " to many buffers opened already, will not work
!   "call assert_fails(":b#", 'E23')
!   "call assert_equal('', @#)
!   e Xfoobar
!   e Xfile2
!   call feedkeys("\<c-^>", 't')
!   call assert_equal("Xfile2", fnamemodify(bufname('%'), ':t'))
!   call feedkeys("f\<c-^>", 't')
!   call assert_equal("Xfile2", fnamemodify(bufname('%'), ':t'))
!   " clean up
!   set nohidden
!   bw!
  endfunc
  
! func! Test_normal22_zet()
    " Test for ZZ
    " let shell = &shell
    " let &shell = 'sh'
--- 1259,1296 ----
    bw!
  endfunc
  
! func Test_normal21_nv_hat()
! 
!   " Edit a fresh file and wipe the buffer list so that there is no alternate
!   " file present.  Next, check for the expected command failures.
!   edit Xfoo | %bw
!   call assert_fails(':buffer #', 'E86')
!   call assert_fails(':execute "normal! \<C-^>"', 'E23')
! 
!   " Test for the expected behavior when switching between two named buffers.
!   edit Xfoo | edit Xbar
!   call feedkeys("\<C-^>", 'tx')
!   call assert_equal('Xfoo', fnamemodify(bufname('%'), ':t'))
!   call feedkeys("\<C-^>", 'tx')
!   call assert_equal('Xbar', fnamemodify(bufname('%'), ':t'))
! 
!   " Test for the expected behavior when only one buffer is named.
!   enew | let l:nr = bufnr('%')
!   call feedkeys("\<C-^>", 'tx')
!   call assert_equal('Xbar', fnamemodify(bufname('%'), ':t'))
!   call feedkeys("\<C-^>", 'tx')
!   call assert_equal('', bufname('%'))
!   call assert_equal(l:nr, bufnr('%'))
! 
!   " Test that no action is taken by "<C-^>" when an operator is pending.
!   edit Xfoo
!   call feedkeys("ci\<C-^>", 'tx')
!   call assert_equal('Xfoo', fnamemodify(bufname('%'), ':t'))
! 
!   %bw!
  endfunc
  
! func Test_normal22_zet()
    " Test for ZZ
    " let shell = &shell
    " let &shell = 'sh'
***************
*** 1298,1304 ****
    " let &shell = shell
  endfunc
  
! func! Test_normal23_K()
    " Test for K command
    new
    call append(0, ['version8.txt', 'man', 'aa%bb', 'cc|dd'])
--- 1312,1318 ----
    " let &shell = shell
  endfunc
  
! func Test_normal23_K()
    " Test for K command
    new
    call append(0, ['version8.txt', 'man', 'aa%bb', 'cc|dd'])
***************
*** 1353,1359 ****
    bw!
  endfunc
  
! func! Test_normal24_rot13()
    " This test uses multi byte characters
    if !has("multi_byte")
      return
--- 1367,1373 ----
    bw!
  endfunc
  
! func Test_normal24_rot13()
    " This test uses multi byte characters
    if !has("multi_byte")
      return
***************
*** 1371,1377 ****
    bw!
  endfunc
  
! func! Test_normal25_tag()
    " Testing for CTRL-] g CTRL-] g]
    " CTRL-W g] CTRL-W CTRL-] CTRL-W g CTRL-]
    h
--- 1385,1391 ----
    bw!
  endfunc
  
! func Test_normal25_tag()
    " Testing for CTRL-] g CTRL-] g]
    " CTRL-W g] CTRL-W CTRL-] CTRL-W g CTRL-]
    h
***************
*** 1438,1444 ****
    helpclose
  endfunc
  
! func! Test_normal26_put()
    " Test for ]p ]P [p and [P
    new
    call append(0, ['while read LINE', 'do', '  ((count++))', '  if [ $? -ne 0 ]; then', "    echo 'Error writing file'", '  fi', 'done'])
--- 1452,1458 ----
    helpclose
  endfunc
  
! func Test_normal26_put()
    " Test for ]p ]P [p and [P
    new
    call append(0, ['while read LINE', 'do', '  ((count++))', '  if [ $? -ne 0 ]; then', "    echo 'Error writing file'", '  fi', 'done'])
***************
*** 1457,1463 ****
    bw!
  endfunc
  
! func! Test_normal27_bracket()
    " Test for [' [` ]' ]`
    call Setup_NewWindow()
    1,21s/.\+/  &   b/
--- 1471,1477 ----
    bw!
  endfunc
  
! func Test_normal27_bracket()
    " Test for [' [` ]' ]`
    call Setup_NewWindow()
    1,21s/.\+/  &   b/
***************
*** 1508,1514 ****
    bw!
  endfunc
  
! func! Test_normal28_parenthesis()
    " basic testing for ( and )
    new
    call append(0, ['This is a test. With some sentences!', '', 'Even with a question? And one more. And no sentence here'])
--- 1522,1528 ----
    bw!
  endfunc
  
! func Test_normal28_parenthesis()
    " basic testing for ( and )
    new
    call append(0, ['This is a test. With some sentences!', '', 'Even with a question? And one more. And no sentence here'])
***************
*** 1705,1711 ****
    bw!
  endfunc
  
! func! Test_normal32_g_cmd1()
    " Test for g*, g#
    new
    call append(0, ['abc.x_foo', 'x_foobar.abc'])
--- 1719,1725 ----
    bw!
  endfunc
  
! func Test_normal32_g_cmd1()
    " Test for g*, g#
    new
    call append(0, ['abc.x_foo', 'x_foobar.abc'])
***************
*** 1836,1842 ****
    bw!
  endfunc
  
! func! Test_g_ctrl_g()
    new
  
    let a = execute(":norm! g\<c-g>")
--- 1850,1856 ----
    bw!
  endfunc
  
! func Test_g_ctrl_g()
    new
  
    let a = execute(":norm! g\<c-g>")
***************
*** 2134,2140 ****
    bw!
  endfunc
  
! func! Test_normal42_halfpage()
    " basic test for Ctrl-D and Ctrl-U
    call Setup_NewWindow()
    call assert_equal(5, &scroll)
--- 2148,2154 ----
    bw!
  endfunc
  
! func Test_normal42_halfpage()
    " basic test for Ctrl-D and Ctrl-U
    call Setup_NewWindow()
    call assert_equal(5, &scroll)
***************
*** 2202,2208 ****
    bw!
  endfunc
  
! func! Test_normal44_textobjects2()
    " basic testing for is and as text objects
    new
    call append(0, ['This is a test. With some sentences!', '', 'Even with a question? And one more. And no sentence here'])
--- 2216,2222 ----
    bw!
  endfunc
  
! func Test_normal44_textobjects2()
    " basic testing for is and as text objects
    new
    call append(0, ['This is a test. With some sentences!', '', 'Even with a question? And one more. And no sentence here'])
***************
*** 2257,2263 ****
    bw!
  endfunc
  
! func! Test_normal45_drop()
    if !has('dnd')
      " The ~ register does not exist
      call assert_beeps('norm! "~')
--- 2271,2277 ----
    bw!
  endfunc
  
! func Test_normal45_drop()
    if !has('dnd')
      " The ~ register does not exist
      call assert_beeps('norm! "~')
***************
*** 2275,2281 ****
    bw!
  endfunc
  
! func! Test_normal46_ignore()
    " This test uses multi byte characters
    if !has("multi_byte")
      return
--- 2289,2295 ----
    bw!
  endfunc
  
! func Test_normal46_ignore()
    " This test uses multi byte characters
    if !has("multi_byte")
      return
***************
*** 2299,2305 ****
    bw!
  endfunc
  
! func! Test_normal47_visual_buf_wipe()
    " This was causing a crash or ml_get error.
    enew!
    call setline(1,'xxx')
--- 2313,2319 ----
    bw!
  endfunc
  
! func Test_normal47_visual_buf_wipe()
    " This was causing a crash or ml_get error.
    enew!
    call setline(1,'xxx')
***************
*** 2313,2319 ****
    set nomodified
  endfunc
  
! func! Test_normal47_autocmd()
    " disabled, does not seem to be possible currently
    throw "Skipped: not possible to test cursorhold autocmd while waiting for input in normal_cmd"
    new
--- 2327,2333 ----
    set nomodified
  endfunc
  
! func Test_normal47_autocmd()
    " disabled, does not seem to be possible currently
    throw "Skipped: not possible to test cursorhold autocmd while waiting for input in normal_cmd"
    new
***************
*** 2331,2344 ****
    bw!
  endfunc
  
! func! Test_normal48_wincmd()
    new
    exe "norm! \<c-w>c"
    call assert_equal(1, winnr('$'))
    call assert_fails(":norm! \<c-w>c", "E444")
  endfunc
  
! func! Test_normal49_counts()
    new
    call setline(1, 'one two three four five six seven eight nine ten')
    1
--- 2345,2358 ----
    bw!
  endfunc
  
! func Test_normal48_wincmd()
    new
    exe "norm! \<c-w>c"
    call assert_equal(1, winnr('$'))
    call assert_fails(":norm! \<c-w>c", "E444")
  endfunc
  
! func Test_normal49_counts()
    new
    call setline(1, 'one two three four five six seven eight nine ten')
    1
***************
*** 2347,2353 ****
    bw!
  endfunc
  
! func! Test_normal50_commandline()
    if !has("timers") || !has("cmdline_hist")
      return
    endif
--- 2361,2367 ----
    bw!
  endfunc
  
! func Test_normal50_commandline()
    if !has("timers") || !has("cmdline_hist")
      return
    endif
***************
*** 2378,2384 ****
    bw!
  endfunc
  
! func! Test_normal51_FileChangedRO()
    if !has("autocmd")
      return
    endif
--- 2392,2398 ----
    bw!
  endfunc
  
! func Test_normal51_FileChangedRO()
    if !has("autocmd")
      return
    endif
***************
*** 2398,2404 ****
    call delete("Xreadonly.log")
  endfunc
  
! func! Test_normal52_rl()
    if !has("rightleft")
      return
    endif
--- 2412,2418 ----
    call delete("Xreadonly.log")
  endfunc
  
! func Test_normal52_rl()
    if !has("rightleft")
      return
    endif
***************
*** 2431,2437 ****
    bw!
  endfunc
  
! func! Test_normal53_digraph()
    if !has('digraphs')
      return
    endif
--- 2445,2451 ----
    bw!
  endfunc
  
! func Test_normal53_digraph()
    if !has('digraphs')
      return
    endif
***************
*** 2532,2534 ****
--- 2546,2571 ----
    %bwipe!
    let &ul = save_ul
  endfunc
+ 
+ func Test_nv_hat_count()
+   %bwipeout!
+   let l:nr = bufnr('%') + 1
+   call assert_fails(':execute "normal! ' . l:nr . '\<C-^>"', 'E92')
+ 
+   edit Xfoo
+   let l:foo_nr = bufnr('Xfoo')
+ 
+   edit Xbar
+   let l:bar_nr = bufnr('Xbar')
+ 
+   " Make sure we are not just using the alternate file.
+   edit Xbaz
+ 
+   call feedkeys(l:foo_nr . "\<C-^>", 'tx')
+   call assert_equal('Xfoo', fnamemodify(bufname('%'), ':t'))
+ 
+   call feedkeys(l:bar_nr . "\<C-^>", 'tx')
+   call assert_equal('Xbar', fnamemodify(bufname('%'), ':t'))
+ 
+   %bwipeout!
+ endfunc
*** ../vim-8.1.0513/src/testdir/test_window_cmd.vim	2018-05-10 18:19:36.000000000 +0200
--- src/testdir/test_window_cmd.vim	2018-11-10 15:47:05.614643165 +0100
***************
*** 103,117 ****
    bw
  endfunc
  
  func Test_window_split_edit_alternate()
-   e Xa
-   e Xb
  
    wincmd ^
!   call assert_equal('Xa', bufname(winbufnr(1)))
!   call assert_equal('Xb', bufname(winbufnr(2)))
  
!   bw Xa Xb
  endfunc
  
  func Test_window_preview()
--- 103,167 ----
    bw
  endfunc
  
+ " Test the ":wincmd ^" and "<C-W>^" commands.
  func Test_window_split_edit_alternate()
  
+   " Test for failure when the alternate buffer/file no longer exists.
+   edit Xfoo | %bw
+   call assert_fails(':wincmd ^', 'E23')
+ 
+   " Test for the expected behavior when we have two named buffers.
+   edit Xfoo | edit Xbar
    wincmd ^
!   call assert_equal('Xfoo', bufname(winbufnr(1)))
!   call assert_equal('Xbar', bufname(winbufnr(2)))
!   only
! 
!   " Test for the expected behavior when the alternate buffer is not named.
!   enew | let l:nr1 = bufnr('%')
!   edit Xfoo | let l:nr2 = bufnr('%')
!   wincmd ^
!   call assert_equal(l:nr1, winbufnr(1))
!   call assert_equal(l:nr2, winbufnr(2))
!   only
! 
!   " Test the Normal mode command.
!   call feedkeys("\<C-W>\<C-^>", 'tx')
!   call assert_equal(l:nr2, winbufnr(1))
!   call assert_equal(l:nr1, winbufnr(2))
! 
!   %bw!
! endfunc
! 
! " Test the ":[count]wincmd ^" and "[count]<C-W>^" commands.
! func Test_window_split_edit_bufnr()
! 
!   %bwipeout
!   let l:nr = bufnr('%') + 1
!   call assert_fails(':execute "normal! ' . l:nr . '\<C-W>\<C-^>"', 'E92')
!   call assert_fails(':' . l:nr . 'wincmd ^', 'E16')
!   call assert_fails(':0wincmd ^', 'E16')
! 
!   edit Xfoo | edit Xbar | edit Xbaz
!   let l:foo_nr = bufnr('Xfoo')
!   let l:bar_nr = bufnr('Xbar')
!   let l:baz_nr = bufnr('Xbaz')
! 
!   call feedkeys(l:foo_nr . "\<C-W>\<C-^>", 'tx')
!   call assert_equal('Xfoo', bufname(winbufnr(1)))
!   call assert_equal('Xbaz', bufname(winbufnr(2)))
!   only
! 
!   call feedkeys(l:bar_nr . "\<C-W>\<C-^>", 'tx')
!   call assert_equal('Xbar', bufname(winbufnr(1)))
!   call assert_equal('Xfoo', bufname(winbufnr(2)))
!   only
! 
!   execute l:baz_nr . 'wincmd ^'
!   call assert_equal('Xbaz', bufname(winbufnr(1)))
!   call assert_equal('Xbar', bufname(winbufnr(2)))
  
!   %bw!
  endfunc
  
  func Test_window_preview()
***************
*** 322,328 ****
    set equalalways
    vsplit
    windo split
!   split 
    wincmd J
    " now we have a frame top-left with two windows, a frame top-right with two
    " windows and a frame at the bottom, full-width.
--- 372,378 ----
    set equalalways
    vsplit
    windo split
!   split
    wincmd J
    " now we have a frame top-left with two windows, a frame top-right with two
    " windows and a frame at the bottom, full-width.
*** ../vim-8.1.0513/src/normal.c	2018-09-30 21:43:17.199693265 +0200
--- src/normal.c	2018-11-10 15:47:05.610643198 +0100
***************
*** 5496,5502 ****
  }
  
  /*
!  * CTRL-^ command, short for ":e #"
   */
      static void
  nv_hat(cmdarg_T *cap)
--- 5496,5503 ----
  }
  
  /*
!  * CTRL-^ command, short for ":e #".  Works even when the alternate buffer is
!  * not named.
   */
      static void
  nv_hat(cmdarg_T *cap)
*** ../vim-8.1.0513/src/window.c	2018-09-30 21:43:17.207693209 +0200
--- src/window.c	2018-11-10 15:53:58.843143892 +0100
***************
*** 151,158 ****
      case '^':
  		CHECK_CMDWIN;
  		reset_VIsual_and_resel();	/* stop Visual mode */
! 		cmd_with_count("split #", cbuf, sizeof(cbuf), Prenum);
! 		do_cmdline_cmd(cbuf);
  		break;
  
  /* open new window */
--- 151,171 ----
      case '^':
  		CHECK_CMDWIN;
  		reset_VIsual_and_resel();	/* stop Visual mode */
! 
! 		if (buflist_findnr(Prenum == 0
! 					? curwin->w_alt_fnum : Prenum) == NULL)
! 		{
! 		    if (Prenum == 0)
! 			EMSG(_(e_noalt));
! 		    else
! 			EMSGN(_("E92: Buffer %ld not found"), Prenum);
! 		    break;
! 		}
! 
! 		if (!curbuf_locked() && win_split(0, 0) == OK)
! 		    (void)buflist_getfile(
! 			    Prenum == 0 ? curwin->w_alt_fnum : Prenum,
! 			    (linenr_T)0, GETF_ALT, FALSE);
  		break;
  
  /* open new window */
*** ../vim-8.1.0513/runtime/doc/windows.txt	2018-05-17 13:42:04.000000000 +0200
--- runtime/doc/windows.txt	2018-11-10 15:47:05.614643165 +0100
***************
*** 81,86 ****
--- 81,90 ----
  functions can be used to convert between the window/tab number and the
  identifier.  There is also the window number, which may change whenever
  windows are opened or closed, see |winnr()|.
+ The window number is only valid in one specific tab.  The window ID is valid
+ across tabs.  For most functions that take a window ID or a window number, the
+ window number only applies to the current tab, while the window ID can refer
+ to a window in any tab.
  
  Each buffer has a unique number and the number will not change within a Vim
  session.  The |bufnr()| and |bufname()| functions can be used to convert
***************
*** 218,231 ****
  		|:find|.  Doesn't split if {file} is not found.
  
  CTRL-W CTRL-^					*CTRL-W_CTRL-^* *CTRL-W_^*
! CTRL-W ^	Does ":split #", split window in two and edit alternate file.
! 		When a count is given, it becomes ":split #N", split window
! 		and edit buffer N.
  
  						*CTRL-W_:*
! CTRL-W :	Does the same as typing |:| : edit a command line.  Useful in a
  		terminal window, where all Vim commands must be preceded with
! 		CTRL-W or 'termkey'.
  
  Note that the 'splitbelow' and 'splitright' options influence where a new
  window will appear.
--- 222,237 ----
  		|:find|.  Doesn't split if {file} is not found.
  
  CTRL-W CTRL-^					*CTRL-W_CTRL-^* *CTRL-W_^*
! CTRL-W ^	Split the current window in two and edit the alternate file.
! 		When a count N is given, split the current window and edit
! 		buffer N.  Similar to ":sp #" and ":sp #N", but it allows the
! 		other buffer to be unnamed.  This command matches the behavior
! 		of |CTRL-^|, except that it splits a window first.
  
  						*CTRL-W_:*
! CTRL-W :	Does the same as typing |:| - enter a command line.  Useful in a
  		terminal window, where all Vim commands must be preceded with
! 		CTRL-W or 'termwinkey'.
  
  Note that the 'splitbelow' and 'splitright' options influence where a new
  window will appear.
*** ../vim-8.1.0513/src/version.c	2018-11-05 21:21:29.800286334 +0100
--- src/version.c	2018-11-10 15:49:12.537568074 +0100
***************
*** 794,795 ****
--- 794,797 ----
  {   /* Add new patch number below this line */
+ /**/
+     514,
  /**/

-- 
The question is:  What do you do with your life?
The wrong answer is: Become the richest guy in the graveyard.
				(billionaire and Oracle founder Larry Ellison)

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