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
|
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0226
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.0226
Problem: Too many #ifdefs.
Solution: Graduate the +vreplace feature, it's not much code and quite a few
#ifdefs.
Files: runtime/doc/change.txt, runtime/doc/various.txt, src/edit.c,
src/evalfunc.c, src/gui.c, src/misc1.c, src/misc2.c, src/normal.c,
src/ops.c, src/screen.c, src/version.c, src/feature.h,
src/globals.h, src/macros.h, src/vim.h
*** ../vim-8.1.0225/runtime/doc/change.txt 2018-06-23 19:22:45.594486390 +0200
--- runtime/doc/change.txt 2018-07-29 15:38:09.666898986 +0200
***************
*** 177,184 ****
<Tab> may replace several characters at once.
Repeat the entered text [count]-1 times. See
|Virtual-Replace-mode| for more details.
- {not available when compiled without the |+vreplace|
- feature}
*c*
["x]c{motion} Delete {motion} text [into register x] and start
--- 177,182 ----
***************
*** 303,310 ****
space. See |gR| and |Virtual-Replace-mode| for more
details. As with |r| a count may be given.
{char} can be entered like with |r|.
- {not available when compiled without the |+vreplace|
- feature}
*digraph-arg*
The argument for Normal mode commands like |r| and |t| is a single character.
--- 301,306 ----
*** ../vim-8.1.0225/runtime/doc/various.txt 2018-06-23 19:22:45.598486362 +0200
--- runtime/doc/various.txt 2018-07-29 15:38:59.894590610 +0200
***************
*** 461,467 ****
N *+virtualedit* |'virtualedit'|
S *+visual* Visual mode |Visual-mode| Always enabled since 7.4.200.
N *+visualextra* extra Visual mode commands |blockwise-operators|
! N *+vreplace* |gR| and |gr|
*+vtp* on MS-Windows console: support for 'termguicolors'
N *+wildignore* |'wildignore'|
N *+wildmenu* |'wildmenu'|
--- 461,467 ----
N *+virtualedit* |'virtualedit'|
S *+visual* Visual mode |Visual-mode| Always enabled since 7.4.200.
N *+visualextra* extra Visual mode commands |blockwise-operators|
! T *+vreplace* |gR| and |gr|
*+vtp* on MS-Windows console: support for 'termguicolors'
N *+wildignore* |'wildignore'|
N *+wildmenu* |'wildmenu'|
*** ../vim-8.1.0225/src/edit.c 2018-07-28 23:12:01.578163697 +0200
--- src/edit.c 2018-07-29 15:43:22.341227944 +0200
***************
*** 463,469 ****
{
ResetRedobuff();
AppendNumberToRedobuff(count);
- #ifdef FEAT_VREPLACE
if (cmdchar == 'V' || cmdchar == 'v')
{
/* "gR" or "gr" command */
--- 463,468 ----
***************
*** 471,477 ****
AppendCharToRedobuff((cmdchar == 'v') ? 'r' : 'R');
}
else
- #endif
{
if (cmdchar == K_PS)
AppendCharToRedobuff('a');
--- 470,475 ----
***************
*** 497,503 ****
#endif
State = REPLACE;
}
- #ifdef FEAT_VREPLACE
else if (cmdchar == 'V' || cmdchar == 'v')
{
State = VREPLACE;
--- 495,500 ----
***************
*** 505,511 ****
orig_line_count = curbuf->b_ml.ml_line_count;
vr_lines_changed = 1;
}
- #endif
else
State = INSERT;
--- 502,507 ----
***************
*** 2042,2048 ****
int save_p_list;
int start_col;
colnr_T vc;
- #ifdef FEAT_VREPLACE
colnr_T orig_col = 0; /* init for GCC */
char_u *new_line, *orig_line = NULL; /* init for GCC */
--- 2038,2043 ----
***************
*** 2052,2058 ****
orig_line = vim_strsave(ml_get_curline()); /* Deal with NULL below */
orig_col = curwin->w_cursor.col;
}
- #endif
/* for the following tricks we don't want list mode */
save_p_list = curwin->w_p_list;
--- 2047,2052 ----
***************
*** 2091,2107 ****
(void)set_indent(amount, call_changed_bytes ? SIN_CHANGED : 0);
else
{
- #ifdef FEAT_VREPLACE
int save_State = State;
/* Avoid being called recursively. */
if (State & VREPLACE_FLAG)
State = INSERT;
- #endif
shift_line(type == INDENT_DEC, round, 1, call_changed_bytes);
- #ifdef FEAT_VREPLACE
State = save_State;
- #endif
}
insstart_less -= curwin->w_cursor.col;
--- 2085,2097 ----
***************
*** 2233,2239 ****
}
}
- #ifdef FEAT_VREPLACE
/*
* For VREPLACE mode, we also have to fix the replace stack. In this case
* it is always possible because we backspace over the whole line and then
--- 2223,2228 ----
***************
*** 2266,2272 ****
vim_free(new_line);
}
- #endif
}
/*
--- 2255,2260 ----
***************
*** 2288,2295 ****
line[i + 1] = NUL;
}
- #if defined(FEAT_VREPLACE) || defined(FEAT_INS_EXPAND) \
- || defined(FEAT_COMMENTS) || defined(PROTO)
/*
* Backspace the cursor until the given column. Handles REPLACE and VREPLACE
* modes correctly. May also be used when not in insert mode at all.
--- 2276,2281 ----
***************
*** 2308,2314 ****
break;
}
}
- #endif
/*
* Like del_char(), but make sure not to go before column "limit_col".
--- 2294,2299 ----
***************
*** 6224,6232 ****
&& (force_format
|| (!VIM_ISWHITE(c)
&& !((State & REPLACE_FLAG)
- #ifdef FEAT_VREPLACE
&& !(State & VREPLACE_FLAG)
- #endif
&& *ml_get_cursor() != NUL)
&& (curwin->w_cursor.lnum != Insstart.lnum
|| ((!has_format_option(FO_INS_LONG)
--- 6209,6215 ----
***************
*** 6471,6481 ****
* When 'ai' is off we don't want a space under the cursor to be
* deleted. Replace it with an 'x' temporarily.
*/
! if (!curbuf->b_p_ai
! #ifdef FEAT_VREPLACE
! && !(State & VREPLACE_FLAG)
! #endif
! )
{
cc = gchar_cursor();
if (VIM_ISWHITE(cc))
--- 6454,6460 ----
* When 'ai' is off we don't want a space under the cursor to be
* deleted. Replace it with an 'x' temporarily.
*/
! if (!curbuf->b_p_ai && !(State & VREPLACE_FLAG))
{
cc = gchar_cursor();
if (VIM_ISWHITE(cc))
***************
*** 6496,6505 ****
int end_foundcol = 0; /* column for start of word */
colnr_T len;
colnr_T virtcol;
- #ifdef FEAT_VREPLACE
int orig_col = 0;
char_u *saved_text = NULL;
- #endif
colnr_T col;
colnr_T end_col;
--- 6475,6482 ----
***************
*** 6669,6679 ****
* stack functions. VREPLACE does not use this, and backspaces
* over the text instead.
*/
- #ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)
orig_col = startcol; /* Will start backspacing from here */
else
- #endif
replace_offset = startcol - end_foundcol;
/*
--- 6646,6654 ----
***************
*** 6688,6694 ****
if (startcol < 0)
startcol = 0;
- #ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)
{
/*
--- 6663,6668 ----
***************
*** 6706,6712 ****
backspace_until_column(foundcol);
}
else
- #endif
{
/* put cursor after pos. to break line */
if (!fo_white_par)
--- 6680,6685 ----
***************
*** 6744,6755 ****
get_number_indent(curwin->w_cursor.lnum - 1);
if (second_indent >= 0)
{
- #ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)
change_indent(INDENT_SET, second_indent,
FALSE, NUL, TRUE);
else
- #endif
#ifdef FEAT_COMMENTS
if (leader_len > 0 && second_indent - leader_len > 0)
{
--- 6717,6726 ----
***************
*** 6778,6784 ****
first_line = FALSE;
}
- #ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)
{
/*
--- 6749,6754 ----
***************
*** 6789,6795 ****
vim_free(saved_text);
}
else
- #endif
{
/*
* Check if cursor is not past the NUL off the line, cindent
--- 6759,6764 ----
***************
*** 7140,7152 ****
}
ai_col = 0;
- #ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)
{
orig_line_count = curbuf->b_ml.ml_line_count;
vr_lines_changed = 1;
}
- #endif
ResetRedobuff();
AppendToRedobuff((char_u *)"1i"); /* pretend we start an insertion */
new_insert_skip = 2;
--- 7109,7119 ----
***************
*** 7983,7989 ****
replace_do_bs(int limit_col)
{
int cc;
- #ifdef FEAT_VREPLACE
int orig_len = 0;
int ins_len;
int orig_vcols = 0;
--- 7950,7955 ----
***************
*** 7991,8002 ****
char_u *p;
int i;
int vcol;
- #endif
cc = replace_pop();
if (cc > 0)
{
- #ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)
{
/* Get the number of screen cells used by the character we are
--- 7957,7966 ----
***************
*** 8004,8032 ****
getvcol(curwin, &curwin->w_cursor, NULL, &start_vcol, NULL);
orig_vcols = chartabsize(ml_get_cursor(), start_vcol);
}
- #endif
#ifdef FEAT_MBYTE
if (has_mbyte)
{
(void)del_char_after_col(limit_col);
- # ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)
orig_len = (int)STRLEN(ml_get_cursor());
- # endif
replace_push(cc);
}
else
#endif
{
pchar_cursor(cc);
- #ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)
orig_len = (int)STRLEN(ml_get_cursor()) - 1;
- #endif
}
replace_pop_ins();
- #ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)
{
/* Get the number of screen cells used by the inserted characters */
--- 7968,7990 ----
***************
*** 8052,8058 ****
}
curwin->w_cursor.col -= ins_len;
}
- #endif
/* mark the buffer as changed and prepare for displaying */
changed_bytes(curwin->w_cursor.lnum, curwin->w_cursor.col);
--- 8010,8015 ----
***************
*** 8966,8976 ****
# ifdef FEAT_EVAL
set_vim_var_string(VV_INSERTMODE,
! (char_u *)((State & REPLACE_FLAG) ? "i" :
! # ifdef FEAT_VREPLACE
! replaceState == VREPLACE ? "v" :
! # endif
! "r"), 1);
# endif
apply_autocmds(EVENT_INSERTCHANGE, NULL, NULL, FALSE, curbuf);
if (State & REPLACE_FLAG)
--- 8923,8931 ----
# ifdef FEAT_EVAL
set_vim_var_string(VV_INSERTMODE,
! (char_u *)((State & REPLACE_FLAG) ? "i"
! : replaceState == VREPLACE ? "v"
! : "r"), 1);
# endif
apply_autocmds(EVENT_INSERTCHANGE, NULL, NULL, FALSE, curbuf);
if (State & REPLACE_FLAG)
***************
*** 8990,9000 ****
static void
ins_ctrl_o(void)
{
- #ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)
restart_edit = 'V';
else
- #endif
if (State & REPLACE_FLAG)
restart_edit = 'R';
else
--- 8945,8953 ----
***************
*** 9067,9080 ****
else
{
curwin->w_cursor.col = temp;
- #ifdef FEAT_VREPLACE
/* Adjust orig_line_count in case more lines have been deleted than
* have been added. That makes sure, that open_line() later
* can access all buffer lines correctly */
if (State & VREPLACE_FLAG &&
orig_line_count > curbuf->b_ml.ml_line_count)
orig_line_count = curbuf->b_ml.ml_line_count;
- #endif
}
}
else if (del_char(FALSE) == FAIL) /* delete char under cursor */
--- 9020,9031 ----
***************
*** 9229,9238 ****
}
else
{
- #ifdef FEAT_VREPLACE
if (!(State & VREPLACE_FLAG)
|| curwin->w_cursor.lnum > orig_line_count)
- #endif
{
temp = gchar_cursor(); /* remember current char */
--curwin->w_cursor.lnum;
--- 9180,9187 ----
***************
*** 9256,9265 ****
if (temp == NUL && gchar_cursor() != NUL)
inc_cursor();
}
- #ifdef FEAT_VREPLACE
else
dec_cursor();
- #endif
/*
* In REPLACE mode we have to put back the text that was replaced
--- 9205,9212 ----
***************
*** 9386,9396 ****
&& curwin->w_cursor.col < Insstart_orig.col)
Insstart_orig.col = curwin->w_cursor.col;
- #ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)
ins_char(' ');
else
- #endif
{
ins_str((char_u *)" ");
if ((State & REPLACE_FLAG))
--- 9333,9341 ----
***************
*** 10231,10241 ****
ins_char(' ');
while (--temp > 0)
{
- #ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)
ins_char(' ');
else
- #endif
{
ins_str((char_u *)" ");
if (State & REPLACE_FLAG) /* no char replaced */
--- 10176,10184 ----
***************
*** 10255,10264 ****
#endif
{
char_u *ptr;
- #ifdef FEAT_VREPLACE
char_u *saved_line = NULL; /* init for GCC */
pos_T pos;
- #endif
pos_T fpos;
pos_T *cursor;
colnr_T want_vcol, vcol;
--- 10198,10205 ----
***************
*** 10269,10275 ****
* Get the current line. For VREPLACE mode, don't make real changes
* yet, just work on a copy of the line.
*/
- #ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)
{
pos = curwin->w_cursor;
--- 10210,10215 ----
***************
*** 10280,10286 ****
ptr = saved_line + pos.col;
}
else
- #endif
{
ptr = ml_get_cursor();
cursor = &curwin->w_cursor;
--- 10220,10225 ----
***************
*** 10360,10370 ****
{
STRMOVE(ptr, ptr + i);
/* correct replace stack. */
! if ((State & REPLACE_FLAG)
! #ifdef FEAT_VREPLACE
! && !(State & VREPLACE_FLAG)
! #endif
! )
for (temp = i; --temp >= 0; )
replace_join(repl_off);
}
--- 10299,10305 ----
{
STRMOVE(ptr, ptr + i);
/* correct replace stack. */
! if ((State & REPLACE_FLAG) && !(State & VREPLACE_FLAG))
for (temp = i; --temp >= 0; )
replace_join(repl_off);
}
***************
*** 10378,10384 ****
#endif
cursor->col -= i;
- #ifdef FEAT_VREPLACE
/*
* In VREPLACE mode, we haven't changed anything yet. Do it now by
* backspacing over the changed spacing and then inserting the new
--- 10313,10318 ----
***************
*** 10394,10406 ****
ins_bytes_len(saved_line + change_col,
cursor->col - change_col);
}
- #endif
}
- #ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)
vim_free(saved_line);
- #endif
curwin->w_p_list = save_list;
}
--- 10328,10337 ----
***************
*** 10427,10437 ****
* character under the cursor. Only push a NUL on the replace stack,
* nothing to put back when the NL is deleted.
*/
! if ((State & REPLACE_FLAG)
! #ifdef FEAT_VREPLACE
! && !(State & VREPLACE_FLAG)
! #endif
! )
replace_push(NUL);
/*
--- 10358,10364 ----
* character under the cursor. Only push a NUL on the replace stack,
* nothing to put back when the NL is deleted.
*/
! if ((State & REPLACE_FLAG) && !(State & VREPLACE_FLAG))
replace_push(NUL);
/*
***************
*** 10700,10710 ****
curwin->w_cursor = *pos;
i = get_indent();
curwin->w_cursor = old_pos;
- #ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)
change_indent(INDENT_SET, i, FALSE, NUL, TRUE);
else
- #endif
(void)set_indent(i, SIN_CHANGED);
}
else if (curwin->w_cursor.col > 0)
--- 10627,10635 ----
*** ../vim-8.1.0225/src/evalfunc.c 2018-07-29 15:34:20.868300075 +0200
--- src/evalfunc.c 2018-07-29 15:43:54.165096144 +0200
***************
*** 6450,6458 ****
#ifdef FEAT_VISUALEXTRA
"visualextra",
#endif
- #ifdef FEAT_VREPLACE
"vreplace",
- #endif
#ifdef FEAT_VTP
"vtp",
#endif
--- 6450,6456 ----
***************
*** 8400,8413 ****
buf[0] = '!';
else if (State & INSERT)
{
- #ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)
{
buf[0] = 'R';
buf[1] = 'v';
}
else
- #endif
{
if (State & REPLACE_FLAG)
buf[0] = 'R';
--- 8398,8409 ----
*** ../vim-8.1.0225/src/gui.c 2018-06-28 12:05:07.089006904 +0200
--- src/gui.c 2018-07-29 15:44:03.357057435 +0200
***************
*** 3181,3190 ****
case SELECTMODE: checkfor = MOUSE_VISUAL; break;
case REPLACE:
case REPLACE+LANGMAP:
- # ifdef FEAT_VREPLACE
case VREPLACE:
case VREPLACE+LANGMAP:
- # endif
case INSERT:
case INSERT+LANGMAP: checkfor = MOUSE_INSERT; break;
case ASKMORE:
--- 3181,3188 ----
*** ../vim-8.1.0225/src/misc1.c 2018-07-25 21:19:09.363656976 +0200
--- src/misc1.c 2018-07-29 15:45:58.180552032 +0200
***************
*** 784,793 ****
char_u *leader = NULL; /* copy of comment leader */
#endif
char_u *allocated = NULL; /* allocated memory */
- #if defined(FEAT_SMARTINDENT) || defined(FEAT_VREPLACE) || defined(FEAT_LISP) \
- || defined(FEAT_CINDENT) || defined(FEAT_COMMENTS)
char_u *p;
- #endif
int saved_char = NUL; /* init for GCC */
#if defined(FEAT_SMARTINDENT) || defined(FEAT_COMMENTS)
pos_T *pos;
--- 784,790 ----
***************
*** 804,810 ****
int no_si = FALSE; /* reset did_si afterwards */
int first_char = NUL; /* init for GCC */
#endif
! #if defined(FEAT_VREPLACE) && (defined(FEAT_LISP) || defined(FEAT_CINDENT))
int vreplace_mode;
#endif
int did_append; /* appended a new line */
--- 801,807 ----
int no_si = FALSE; /* reset did_si afterwards */
int first_char = NUL; /* init for GCC */
#endif
! #if defined(FEAT_LISP) || defined(FEAT_CINDENT)
int vreplace_mode;
#endif
int did_append; /* appended a new line */
***************
*** 817,823 ****
if (saved_line == NULL) /* out of memory! */
return FALSE;
- #ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)
{
/*
--- 814,819 ----
***************
*** 857,869 ****
}
saved_line[curwin->w_cursor.col] = NUL;
}
- #endif
! if ((State & INSERT)
! #ifdef FEAT_VREPLACE
! && !(State & VREPLACE_FLAG)
! #endif
! )
{
p_extra = saved_line + curwin->w_cursor.col;
#ifdef FEAT_SMARTINDENT
--- 853,860 ----
}
saved_line[curwin->w_cursor.col] = NUL;
}
! if ((State & INSERT) && !(State & VREPLACE_FLAG))
{
p_extra = saved_line + curwin->w_cursor.col;
#ifdef FEAT_SMARTINDENT
***************
*** 1601,1609 ****
old_cursor = curwin->w_cursor;
if (dir == BACKWARD)
--curwin->w_cursor.lnum;
- #ifdef FEAT_VREPLACE
if (!(State & VREPLACE_FLAG) || old_cursor.lnum >= orig_line_count)
- #endif
{
if (ml_append(curwin->w_cursor.lnum, p_extra, (colnr_T)0, FALSE)
== FAIL)
--- 1592,1598 ----
***************
*** 1620,1626 ****
mark_adjust(curwin->w_cursor.lnum + 1, (linenr_T)MAXLNUM, 1L, 0L);
did_append = TRUE;
}
- #ifdef FEAT_VREPLACE
else
{
/*
--- 1609,1614 ----
***************
*** 1640,1646 ****
curwin->w_cursor.lnum--;
did_append = FALSE;
}
- #endif
if (newindent
#ifdef FEAT_SMARTINDENT
--- 1628,1633 ----
***************
*** 1744,1750 ****
curwin->w_cursor.coladd = 0;
#endif
! #if defined(FEAT_VREPLACE) && (defined(FEAT_LISP) || defined(FEAT_CINDENT))
/*
* In VREPLACE mode, we are handling the replace stack ourselves, so stop
* fixthisline() from doing it (via change_indent()) by telling it we're in
--- 1731,1737 ----
curwin->w_cursor.coladd = 0;
#endif
! #if defined(FEAT_LISP) || defined(FEAT_CINDENT)
/*
* In VREPLACE mode, we are handling the replace stack ourselves, so stop
* fixthisline() from doing it (via change_indent()) by telling it we're in
***************
*** 1791,1802 ****
ai_col = (colnr_T)getwhitecols_curline();
}
#endif
! #if defined(FEAT_VREPLACE) && (defined(FEAT_LISP) || defined(FEAT_CINDENT))
if (vreplace_mode != 0)
State = vreplace_mode;
#endif
- #ifdef FEAT_VREPLACE
/*
* Finally, VREPLACE gets the stuff on the new line, then puts back the
* original line, and inserts the new stuff char by char, pushing old stuff
--- 1778,1788 ----
ai_col = (colnr_T)getwhitecols_curline();
}
#endif
! #if defined(FEAT_LISP) || defined(FEAT_CINDENT)
if (vreplace_mode != 0)
State = vreplace_mode;
#endif
/*
* Finally, VREPLACE gets the stuff on the new line, then puts back the
* original line, and inserts the new stuff char by char, pushing old stuff
***************
*** 1821,1827 ****
vim_free(p_extra);
next_line = NULL;
}
- #endif
retval = OK; /* success! */
theend:
--- 1807,1812 ----
***************
*** 2307,2313 ****
return (count);
}
- #if defined(FEAT_VREPLACE) || defined(FEAT_INS_EXPAND) || defined(PROTO)
/*
* Insert string "p" at the cursor position. Stops at a NUL byte.
* Handles Replace mode and multi-byte characters.
--- 2292,2297 ----
***************
*** 2317,2326 ****
{
ins_bytes_len(p, (int)STRLEN(p));
}
- #endif
- #if defined(FEAT_VREPLACE) || defined(FEAT_INS_EXPAND) \
- || defined(FEAT_COMMENTS) || defined(FEAT_MBYTE) || defined(PROTO)
/*
* Insert string "p" with length "len" at the cursor position.
* Handles Replace mode and multi-byte characters.
--- 2301,2307 ----
***************
*** 2329,2335 ****
ins_bytes_len(char_u *p, int len)
{
int i;
! # ifdef FEAT_MBYTE
int n;
if (has_mbyte)
--- 2310,2316 ----
ins_bytes_len(char_u *p, int len)
{
int i;
! #ifdef FEAT_MBYTE
int n;
if (has_mbyte)
***************
*** 2343,2353 ****
ins_char_bytes(p + i, n);
}
else
! # endif
for (i = 0; i < len; ++i)
ins_char(p[i]);
}
- #endif
/*
* Insert or replace a single character at the cursor position.
--- 2324,2333 ----
ins_char_bytes(p + i, n);
}
else
! #endif
for (i = 0; i < len; ++i)
ins_char(p[i]);
}
/*
* Insert or replace a single character at the cursor position.
***************
*** 2406,2412 ****
if (State & REPLACE_FLAG)
{
- #ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)
{
colnr_T new_vcol = 0; /* init for GCC */
--- 2386,2391 ----
***************
*** 2456,2462 ****
curwin->w_p_list = old_list;
}
else
- #endif
if (oldp[col] != NUL)
{
/* normal replace */
--- 2435,2440 ----
*** ../vim-8.1.0225/src/misc2.c 2018-06-29 20:28:27.505661796 +0200
--- src/misc2.c 2018-07-29 15:46:23.876433899 +0200
***************
*** 3766,3775 ****
#endif
if (!mouse && State == SHOWMATCH)
return SHAPE_IDX_SM;
- #ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)
return SHAPE_IDX_R;
- #endif
if (State & REPLACE_FLAG)
return SHAPE_IDX_R;
if (State & INSERT)
--- 3766,3773 ----
*** ../vim-8.1.0225/src/normal.c 2018-07-25 22:36:48.987518583 +0200
--- src/normal.c 2018-07-29 15:46:49.824312935 +0200
***************
*** 111,119 ****
static void nv_undo(cmdarg_T *cap);
static void nv_kundo(cmdarg_T *cap);
static void nv_Replace(cmdarg_T *cap);
- #ifdef FEAT_VREPLACE
static void nv_vreplace(cmdarg_T *cap);
- #endif
static void v_swap_corners(int cmdchar);
static void nv_replace(cmdarg_T *cap);
static void n_swapchar(cmdarg_T *cap);
--- 111,117 ----
***************
*** 7300,7306 ****
}
}
- #ifdef FEAT_VREPLACE
/*
* "gr".
*/
--- 7298,7303 ----
***************
*** 7323,7337 ****
cap->extra_char = get_literal();
stuffcharReadbuff(cap->extra_char);
stuffcharReadbuff(ESC);
! # ifdef FEAT_VIRTUALEDIT
if (virtual_active())
coladvance(getviscol());
! # endif
invoke_edit(cap, TRUE, 'v', FALSE);
}
}
}
- #endif
/*
* Swap case for "~" command, when it does not work like an operator.
--- 7320,7333 ----
cap->extra_char = get_literal();
stuffcharReadbuff(cap->extra_char);
stuffcharReadbuff(ESC);
! #ifdef FEAT_VIRTUALEDIT
if (virtual_active())
coladvance(getviscol());
! #endif
invoke_edit(cap, TRUE, 'v', FALSE);
}
}
}
/*
* Swap case for "~" command, when it does not work like an operator.
***************
*** 7944,7950 ****
clearopbeep(oap);
break;
- #ifdef FEAT_VREPLACE
/*
* "gR": Enter virtual replace mode.
*/
--- 7940,7945 ----
***************
*** 7956,7962 ****
case 'r':
nv_vreplace(cap);
break;
- #endif
case '&':
do_cmdline_cmd((char_u *)"%s//~/&");
--- 7951,7956 ----
*** ../vim-8.1.0225/src/ops.c 2018-07-08 16:50:33.107216836 +0200
--- src/ops.c 2018-07-29 15:47:03.452248760 +0200
***************
*** 376,386 ****
}
/* Set new indent */
- #ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)
change_indent(INDENT_SET, count, FALSE, NUL, call_changed_bytes);
else
- #endif
(void)set_indent(count, call_changed_bytes ? SIN_CHANGED : 0);
}
--- 376,384 ----
*** ../vim-8.1.0225/src/screen.c 2018-06-28 22:22:56.233315600 +0200
--- src/screen.c 2018-07-29 15:47:23.308154491 +0200
***************
*** 10375,10386 ****
else
#endif
{
- #ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)
MSG_PUTS_ATTR(_(" VREPLACE"), attr);
! else
! #endif
! if (State & REPLACE_FLAG)
MSG_PUTS_ATTR(_(" REPLACE"), attr);
else if (State & INSERT)
{
--- 10375,10383 ----
else
#endif
{
if (State & VREPLACE_FLAG)
MSG_PUTS_ATTR(_(" VREPLACE"), attr);
! else if (State & REPLACE_FLAG)
MSG_PUTS_ATTR(_(" REPLACE"), attr);
else if (State & INSERT)
{
*** ../vim-8.1.0225/src/version.c 2018-07-29 15:34:20.868300075 +0200
--- src/version.c 2018-07-29 15:50:26.887245482 +0200
***************
*** 714,724 ****
#else
"-viminfo",
#endif
- #ifdef FEAT_VREPLACE
"+vreplace",
- #else
- "-vreplace",
- #endif
#ifdef WIN3264
# ifdef FEAT_VTP
"+vtp",
--- 714,720 ----
*** ../vim-8.1.0225/src/feature.h 2018-06-23 19:22:45.606486311 +0200
--- src/feature.h 2018-07-29 15:47:53.028011765 +0200
***************
*** 207,219 ****
#endif
/*
- * +vreplace "gR" and "gr" commands.
- */
- #ifdef FEAT_NORMAL
- # define FEAT_VREPLACE
- #endif
-
- /*
* +cmdline_info 'showcmd' and 'ruler' options.
*/
#ifdef FEAT_NORMAL
--- 207,212 ----
*** ../vim-8.1.0225/src/globals.h 2018-06-23 16:12:15.780258265 +0200
--- src/globals.h 2018-07-29 15:48:07.903939623 +0200
***************
*** 778,790 ****
* op_insert(), to detect correctly where inserting by the user started. */
EXTERN pos_T Insstart_orig;
- #ifdef FEAT_VREPLACE
/*
* Stuff for VREPLACE mode.
*/
EXTERN int orig_line_count INIT(= 0); /* Line count when "gR" started */
EXTERN int vr_lines_changed INIT(= 0); /* #Lines changed by "gR" so far */
- #endif
#if defined(FEAT_X11) && defined(FEAT_XCLIPBOARD)
/* argument to SETJMP() for handling X IO errors */
--- 778,788 ----
*** ../vim-8.1.0225/src/macros.h 2018-06-28 19:26:24.321655175 +0200
--- src/macros.h 2018-07-29 15:48:34.883807640 +0200
***************
*** 235,245 ****
# define TIME_MSG(s) do { /**/ } while (0)
#endif
! #ifdef FEAT_VREPLACE
! # define REPLACE_NORMAL(s) (((s) & REPLACE_FLAG) && !((s) & VREPLACE_FLAG))
! #else
! # define REPLACE_NORMAL(s) ((s) & REPLACE_FLAG)
! #endif
#ifdef FEAT_ARABIC
# define UTF_COMPOSINGLIKE(p1, p2) utf_composinglike((p1), (p2))
--- 235,241 ----
# define TIME_MSG(s) do { /**/ } while (0)
#endif
! #define REPLACE_NORMAL(s) (((s) & REPLACE_FLAG) && !((s) & VREPLACE_FLAG))
#ifdef FEAT_ARABIC
# define UTF_COMPOSINGLIKE(p1, p2) utf_composinglike((p1), (p2))
*** ../vim-8.1.0225/src/vim.h 2018-06-23 14:21:38.467484932 +0200
--- src/vim.h 2018-07-29 15:48:48.695739525 +0200
***************
*** 675,684 ****
#define REPLACE_FLAG 0x40 /* Replace mode flag */
#define REPLACE (REPLACE_FLAG + INSERT)
! #ifdef FEAT_VREPLACE
! # define VREPLACE_FLAG 0x80 /* Virtual-replace mode flag */
! # define VREPLACE (REPLACE_FLAG + VREPLACE_FLAG + INSERT)
! #endif
#define LREPLACE (REPLACE_FLAG + LANGMAP)
#define NORMAL_BUSY (0x100 + NORMAL) /* Normal mode, busy with a command */
--- 675,682 ----
#define REPLACE_FLAG 0x40 /* Replace mode flag */
#define REPLACE (REPLACE_FLAG + INSERT)
! #define VREPLACE_FLAG 0x80 /* Virtual-replace mode flag */
! #define VREPLACE (REPLACE_FLAG + VREPLACE_FLAG + INSERT)
#define LREPLACE (REPLACE_FLAG + LANGMAP)
#define NORMAL_BUSY (0x100 + NORMAL) /* Normal mode, busy with a command */
*** ../vim-8.1.0225/src/version.c 2018-07-29 15:34:20.868300075 +0200
--- src/version.c 2018-07-29 15:50:26.887245482 +0200
***************
*** 800,801 ****
--- 796,799 ----
{ /* Add new patch number below this line */
+ /**/
+ 226,
/**/
--
Shit makes the flowers grow and that's beautiful
/// 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 ///
|