comparison src/undo.c @ 13380:69517d67421f v8.0.1564

patch 8.0.1564: too many #ifdefs commit https://github.com/vim/vim/commit/f2bd8ef2b4507d02c6043affff8f7e85e3414d5f Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 4 18:08:14 2018 +0100 patch 8.0.1564: too many #ifdefs Problem: Too many #ifdefs. Solution: Graduate the +autocmd feature. Takes away 450 #ifdefs and increases code size of tiny Vim by only 40 Kbyte.
author Christian Brabandt <cb@256bit.org>
date Sun, 04 Mar 2018 18:15:08 +0100
parents ac42c4b11dbc
children e76499e85744
comparison
equal deleted inserted replaced
13379:0f9dd1b43244 13380:69517d67421f
422 #ifdef FEAT_TERMINAL 422 #ifdef FEAT_TERMINAL
423 /* A change in a terminal buffer removes the highlighting. */ 423 /* A change in a terminal buffer removes the highlighting. */
424 term_change_in_curbuf(); 424 term_change_in_curbuf();
425 #endif 425 #endif
426 426
427 #ifdef FEAT_AUTOCMD
428 /* 427 /*
429 * Saving text for undo means we are going to make a change. Give a 428 * Saving text for undo means we are going to make a change. Give a
430 * warning for a read-only file before making the change, so that the 429 * warning for a read-only file before making the change, so that the
431 * FileChangedRO event can replace the buffer with a read-write version 430 * FileChangedRO event can replace the buffer with a read-write version
432 * (e.g., obtained from a source control system). 431 * (e.g., obtained from a source control system).
437 /* This happens when the FileChangedRO autocommand changes the 436 /* This happens when the FileChangedRO autocommand changes the
438 * file in a way it becomes shorter. */ 437 * file in a way it becomes shorter. */
439 EMSG(_("E881: Line count changed unexpectedly")); 438 EMSG(_("E881: Line count changed unexpectedly"));
440 return FAIL; 439 return FAIL;
441 } 440 }
442 #endif
443 } 441 }
444 442
445 #ifdef U_DEBUG 443 #ifdef U_DEBUG
446 u_check(FALSE); 444 u_check(FALSE);
447 #endif 445 #endif
2629 pos_T namedm[NMARKS]; 2627 pos_T namedm[NMARKS];
2630 visualinfo_T visualinfo; 2628 visualinfo_T visualinfo;
2631 int empty_buffer; /* buffer became empty */ 2629 int empty_buffer; /* buffer became empty */
2632 u_header_T *curhead = curbuf->b_u_curhead; 2630 u_header_T *curhead = curbuf->b_u_curhead;
2633 2631
2634 #ifdef FEAT_AUTOCMD
2635 /* Don't want autocommands using the undo structures here, they are 2632 /* Don't want autocommands using the undo structures here, they are
2636 * invalid till the end. */ 2633 * invalid till the end. */
2637 block_autocmds(); 2634 block_autocmds();
2638 #endif
2639 2635
2640 #ifdef U_DEBUG 2636 #ifdef U_DEBUG
2641 u_check(FALSE); 2637 u_check(FALSE);
2642 #endif 2638 #endif
2643 old_flags = curhead->uh_flags; 2639 old_flags = curhead->uh_flags;
2662 if (bot == 0) 2658 if (bot == 0)
2663 bot = curbuf->b_ml.ml_line_count + 1; 2659 bot = curbuf->b_ml.ml_line_count + 1;
2664 if (top > curbuf->b_ml.ml_line_count || top >= bot 2660 if (top > curbuf->b_ml.ml_line_count || top >= bot
2665 || bot > curbuf->b_ml.ml_line_count + 1) 2661 || bot > curbuf->b_ml.ml_line_count + 1)
2666 { 2662 {
2667 #ifdef FEAT_AUTOCMD
2668 unblock_autocmds(); 2663 unblock_autocmds();
2669 #endif
2670 IEMSG(_("E438: u_undo: line numbers wrong")); 2664 IEMSG(_("E438: u_undo: line numbers wrong"));
2671 changed(); /* don't want UNCHANGED now */ 2665 changed(); /* don't want UNCHANGED now */
2672 return; 2666 return;
2673 } 2667 }
2674 2668
2889 2883
2890 /* The timestamp can be the same for multiple changes, just use the one of 2884 /* The timestamp can be the same for multiple changes, just use the one of
2891 * the undone/redone change. */ 2885 * the undone/redone change. */
2892 curbuf->b_u_time_cur = curhead->uh_time; 2886 curbuf->b_u_time_cur = curhead->uh_time;
2893 2887
2894 #ifdef FEAT_AUTOCMD
2895 unblock_autocmds(); 2888 unblock_autocmds();
2896 #endif
2897 #ifdef U_DEBUG 2889 #ifdef U_DEBUG
2898 u_check(FALSE); 2890 u_check(FALSE);
2899 #endif 2891 #endif
2900 } 2892 }
2901 2893