comparison src/undo.c @ 5735:50dbef5e774a v7.4.212

updated for version 7.4.212 Problem: Now that the +visual feature is always enabled the #ifdefs for it are not useful. Solution: Remove the checks for FEAT_VISUAL.
author Bram Moolenaar <bram@vim.org>
date Sun, 23 Mar 2014 15:13:05 +0100
parents 47a673b20e49
children 410ef4f1a3d2
comparison
equal deleted inserted replaced
5734:657ade71d395 5735:50dbef5e774a
530 uhp->uh_flags = (curbuf->b_changed ? UH_CHANGED : 0) + 530 uhp->uh_flags = (curbuf->b_changed ? UH_CHANGED : 0) +
531 ((curbuf->b_ml.ml_flags & ML_EMPTY) ? UH_EMPTYBUF : 0); 531 ((curbuf->b_ml.ml_flags & ML_EMPTY) ? UH_EMPTYBUF : 0);
532 532
533 /* save named marks and Visual marks for undo */ 533 /* save named marks and Visual marks for undo */
534 mch_memmove(uhp->uh_namedm, curbuf->b_namedm, sizeof(pos_T) * NMARKS); 534 mch_memmove(uhp->uh_namedm, curbuf->b_namedm, sizeof(pos_T) * NMARKS);
535 #ifdef FEAT_VISUAL
536 uhp->uh_visual = curbuf->b_visual; 535 uhp->uh_visual = curbuf->b_visual;
537 #endif
538 536
539 curbuf->b_u_newhead = uhp; 537 curbuf->b_u_newhead = uhp;
540 if (curbuf->b_u_oldhead == NULL) 538 if (curbuf->b_u_oldhead == NULL)
541 curbuf->b_u_oldhead = uhp; 539 curbuf->b_u_oldhead = uhp;
542 ++curbuf->b_u_numhead; 540 ++curbuf->b_u_numhead;
1012 #endif 1010 #endif
1013 put_bytes(fp, (long_u)uhp->uh_flags, 2); 1011 put_bytes(fp, (long_u)uhp->uh_flags, 2);
1014 /* Assume NMARKS will stay the same. */ 1012 /* Assume NMARKS will stay the same. */
1015 for (i = 0; i < NMARKS; ++i) 1013 for (i = 0; i < NMARKS; ++i)
1016 serialize_pos(uhp->uh_namedm[i], fp); 1014 serialize_pos(uhp->uh_namedm[i], fp);
1017 #ifdef FEAT_VISUAL
1018 serialize_visualinfo(&uhp->uh_visual, fp); 1015 serialize_visualinfo(&uhp->uh_visual, fp);
1019 #else
1020 {
1021 visualinfo_T info;
1022
1023 memset(&info, 0, sizeof(visualinfo_T));
1024 serialize_visualinfo(&info, fp);
1025 }
1026 #endif
1027 put_time(fp, uhp->uh_time); 1016 put_time(fp, uhp->uh_time);
1028 1017
1029 /* Optional fields. */ 1018 /* Optional fields. */
1030 putc(4, fp); 1019 putc(4, fp);
1031 putc(UHP_SAVE_NR, fp); 1020 putc(UHP_SAVE_NR, fp);
1080 (void)get4c(fp); 1069 (void)get4c(fp);
1081 #endif 1070 #endif
1082 uhp->uh_flags = get2c(fp); 1071 uhp->uh_flags = get2c(fp);
1083 for (i = 0; i < NMARKS; ++i) 1072 for (i = 0; i < NMARKS; ++i)
1084 unserialize_pos(&uhp->uh_namedm[i], fp); 1073 unserialize_pos(&uhp->uh_namedm[i], fp);
1085 #ifdef FEAT_VISUAL
1086 unserialize_visualinfo(&uhp->uh_visual, fp); 1074 unserialize_visualinfo(&uhp->uh_visual, fp);
1087 #else
1088 {
1089 visualinfo_T info;
1090 unserialize_visualinfo(&info, fp);
1091 }
1092 #endif
1093 uhp->uh_time = get8ctime(fp); 1075 uhp->uh_time = get8ctime(fp);
1094 1076
1095 /* Optional fields. */ 1077 /* Optional fields. */
1096 for (;;) 1078 for (;;)
1097 { 1079 {
2404 u_entry_T *uep, *nuep; 2386 u_entry_T *uep, *nuep;
2405 u_entry_T *newlist = NULL; 2387 u_entry_T *newlist = NULL;
2406 int old_flags; 2388 int old_flags;
2407 int new_flags; 2389 int new_flags;
2408 pos_T namedm[NMARKS]; 2390 pos_T namedm[NMARKS];
2409 #ifdef FEAT_VISUAL
2410 visualinfo_T visualinfo; 2391 visualinfo_T visualinfo;
2411 #endif
2412 int empty_buffer; /* buffer became empty */ 2392 int empty_buffer; /* buffer became empty */
2413 u_header_T *curhead = curbuf->b_u_curhead; 2393 u_header_T *curhead = curbuf->b_u_curhead;
2414 2394
2415 #ifdef FEAT_AUTOCMD 2395 #ifdef FEAT_AUTOCMD
2416 /* Don't want autocommands using the undo structures here, they are 2396 /* Don't want autocommands using the undo structures here, they are
2428 2408
2429 /* 2409 /*
2430 * save marks before undo/redo 2410 * save marks before undo/redo
2431 */ 2411 */
2432 mch_memmove(namedm, curbuf->b_namedm, sizeof(pos_T) * NMARKS); 2412 mch_memmove(namedm, curbuf->b_namedm, sizeof(pos_T) * NMARKS);
2433 #ifdef FEAT_VISUAL
2434 visualinfo = curbuf->b_visual; 2413 visualinfo = curbuf->b_visual;
2435 #endif
2436 curbuf->b_op_start.lnum = curbuf->b_ml.ml_line_count; 2414 curbuf->b_op_start.lnum = curbuf->b_ml.ml_line_count;
2437 curbuf->b_op_start.col = 0; 2415 curbuf->b_op_start.col = 0;
2438 curbuf->b_op_end.lnum = 0; 2416 curbuf->b_op_end.lnum = 0;
2439 curbuf->b_op_end.col = 0; 2417 curbuf->b_op_end.col = 0;
2440 2418
2600 if (curhead->uh_namedm[i].lnum != 0) 2578 if (curhead->uh_namedm[i].lnum != 0)
2601 { 2579 {
2602 curbuf->b_namedm[i] = curhead->uh_namedm[i]; 2580 curbuf->b_namedm[i] = curhead->uh_namedm[i];
2603 curhead->uh_namedm[i] = namedm[i]; 2581 curhead->uh_namedm[i] = namedm[i];
2604 } 2582 }
2605 #ifdef FEAT_VISUAL
2606 if (curhead->uh_visual.vi_start.lnum != 0) 2583 if (curhead->uh_visual.vi_start.lnum != 0)
2607 { 2584 {
2608 curbuf->b_visual = curhead->uh_visual; 2585 curbuf->b_visual = curhead->uh_visual;
2609 curhead->uh_visual = visualinfo; 2586 curhead->uh_visual = visualinfo;
2610 } 2587 }
2611 #endif
2612 2588
2613 /* 2589 /*
2614 * If the cursor is only off by one line, put it at the same position as 2590 * If the cursor is only off by one line, put it at the same position as
2615 * before starting the change (for the "o" command). 2591 * before starting the change (for the "o" command).
2616 * Otherwise the cursor should go to the first undone line. 2592 * Otherwise the cursor should go to the first undone line.