Mercurial > vim
comparison src/misc1.c @ 15636:6f1c7e9a6393 v8.1.0826
patch 8.1.0826: too many #ifdefs
commit https://github.com/vim/vim/commit/29ddebef4038d2d2b3bc9d8d3b0109f4046d6fbf
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 26 17:28:26 2019 +0100
patch 8.1.0826: too many #ifdefs
Problem: Too many #ifdefs.
Solution: Graduate FEAT_VIRTUALEDIT. Adds about 10Kbyte to the code.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 26 Jan 2019 17:30:15 +0100 |
parents | 536dd2bc5ac9 |
children | 2d941023bd2f |
comparison
equal
deleted
inserted
replaced
15635:c51d2a06f5f9 | 15636:6f1c7e9a6393 |
---|---|
620 * start matching for the flp beyond any comment leader... */ | 620 * start matching for the flp beyond any comment leader... */ |
621 if (vim_regexec(®match, ml_get(lnum) + lead_len, (colnr_T)0)) | 621 if (vim_regexec(®match, ml_get(lnum) + lead_len, (colnr_T)0)) |
622 { | 622 { |
623 pos.lnum = lnum; | 623 pos.lnum = lnum; |
624 pos.col = (colnr_T)(*regmatch.endp - ml_get(lnum)); | 624 pos.col = (colnr_T)(*regmatch.endp - ml_get(lnum)); |
625 #ifdef FEAT_VIRTUALEDIT | |
626 pos.coladd = 0; | 625 pos.coladd = 0; |
627 #endif | |
628 } | 626 } |
629 vim_regfree(regmatch.regprog); | 627 vim_regfree(regmatch.regprog); |
630 } | 628 } |
631 | 629 |
632 if (pos.lnum == 0 || *ml_get_pos(&pos) == NUL) | 630 if (pos.lnum == 0 || *ml_get_pos(&pos) == NUL) |
1706 } | 1704 } |
1707 if (did_append) | 1705 if (did_append) |
1708 changed_lines(curwin->w_cursor.lnum, 0, curwin->w_cursor.lnum, 1L); | 1706 changed_lines(curwin->w_cursor.lnum, 0, curwin->w_cursor.lnum, 1L); |
1709 | 1707 |
1710 curwin->w_cursor.col = newcol; | 1708 curwin->w_cursor.col = newcol; |
1711 #ifdef FEAT_VIRTUALEDIT | |
1712 curwin->w_cursor.coladd = 0; | 1709 curwin->w_cursor.coladd = 0; |
1713 #endif | |
1714 | 1710 |
1715 #if defined(FEAT_LISP) || defined(FEAT_CINDENT) | 1711 #if defined(FEAT_LISP) || defined(FEAT_CINDENT) |
1716 /* | 1712 /* |
1717 * In VREPLACE mode, we are handling the replace stack ourselves, so stop | 1713 * In VREPLACE mode, we are handling the replace stack ourselves, so stop |
1718 * fixthisline() from doing it (via change_indent()) by telling it we're in | 1714 * fixthisline() from doing it (via change_indent()) by telling it we're in |
1779 /* Put back original line */ | 1775 /* Put back original line */ |
1780 ml_replace(curwin->w_cursor.lnum, next_line, FALSE); | 1776 ml_replace(curwin->w_cursor.lnum, next_line, FALSE); |
1781 | 1777 |
1782 /* Insert new stuff into line again */ | 1778 /* Insert new stuff into line again */ |
1783 curwin->w_cursor.col = 0; | 1779 curwin->w_cursor.col = 0; |
1784 #ifdef FEAT_VIRTUALEDIT | |
1785 curwin->w_cursor.coladd = 0; | 1780 curwin->w_cursor.coladd = 0; |
1786 #endif | |
1787 ins_bytes(p_extra); /* will call changed_bytes() */ | 1781 ins_bytes(p_extra); /* will call changed_bytes() */ |
1788 vim_free(p_extra); | 1782 vim_free(p_extra); |
1789 next_line = NULL; | 1783 next_line = NULL; |
1790 } | 1784 } |
1791 | 1785 |
2352 int linelen; // length of old line including NUL | 2346 int linelen; // length of old line including NUL |
2353 colnr_T col; | 2347 colnr_T col; |
2354 linenr_T lnum = curwin->w_cursor.lnum; | 2348 linenr_T lnum = curwin->w_cursor.lnum; |
2355 int i; | 2349 int i; |
2356 | 2350 |
2357 #ifdef FEAT_VIRTUALEDIT | |
2358 /* Break tabs if needed. */ | 2351 /* Break tabs if needed. */ |
2359 if (virtual_active() && curwin->w_cursor.coladd > 0) | 2352 if (virtual_active() && curwin->w_cursor.coladd > 0) |
2360 coladvance_force(getviscol()); | 2353 coladvance_force(getviscol()); |
2361 #endif | |
2362 | 2354 |
2363 col = curwin->w_cursor.col; | 2355 col = curwin->w_cursor.col; |
2364 oldp = ml_get(lnum); | 2356 oldp = ml_get(lnum); |
2365 linelen = (int)STRLEN(oldp) + 1; | 2357 linelen = (int)STRLEN(oldp) + 1; |
2366 | 2358 |
2497 int newlen = (int)STRLEN(s); | 2489 int newlen = (int)STRLEN(s); |
2498 int oldlen; | 2490 int oldlen; |
2499 colnr_T col; | 2491 colnr_T col; |
2500 linenr_T lnum = curwin->w_cursor.lnum; | 2492 linenr_T lnum = curwin->w_cursor.lnum; |
2501 | 2493 |
2502 #ifdef FEAT_VIRTUALEDIT | |
2503 if (virtual_active() && curwin->w_cursor.coladd > 0) | 2494 if (virtual_active() && curwin->w_cursor.coladd > 0) |
2504 coladvance_force(getviscol()); | 2495 coladvance_force(getviscol()); |
2505 #endif | |
2506 | 2496 |
2507 col = curwin->w_cursor.col; | 2497 col = curwin->w_cursor.col; |
2508 oldp = ml_get(lnum); | 2498 oldp = ml_get(lnum); |
2509 oldlen = (int)STRLEN(oldp); | 2499 oldlen = (int)STRLEN(oldp); |
2510 | 2500 |
2635 * If we just took off the last character of a non-blank line, and | 2625 * If we just took off the last character of a non-blank line, and |
2636 * fixpos is TRUE, we don't want to end up positioned at the NUL, | 2626 * fixpos is TRUE, we don't want to end up positioned at the NUL, |
2637 * unless "restart_edit" is set or 'virtualedit' contains "onemore". | 2627 * unless "restart_edit" is set or 'virtualedit' contains "onemore". |
2638 */ | 2628 */ |
2639 if (col > 0 && fixpos && restart_edit == 0 | 2629 if (col > 0 && fixpos && restart_edit == 0 |
2640 #ifdef FEAT_VIRTUALEDIT | 2630 && (ve_flags & VE_ONEMORE) == 0) |
2641 && (ve_flags & VE_ONEMORE) == 0 | |
2642 #endif | |
2643 ) | |
2644 { | 2631 { |
2645 --curwin->w_cursor.col; | 2632 --curwin->w_cursor.col; |
2646 #ifdef FEAT_VIRTUALEDIT | |
2647 curwin->w_cursor.coladd = 0; | 2633 curwin->w_cursor.coladd = 0; |
2648 #endif | |
2649 if (has_mbyte) | 2634 if (has_mbyte) |
2650 curwin->w_cursor.col -= | 2635 curwin->w_cursor.col -= |
2651 (*mb_head_off)(oldp, oldp + curwin->w_cursor.col); | 2636 (*mb_head_off)(oldp, oldp + curwin->w_cursor.col); |
2652 } | 2637 } |
2653 count = oldlen - col; | 2638 count = oldlen - col; |