Mercurial > vim
comparison src/buffer.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 | 1ec942f1b648 |
children | 2fe4a503c5ad |
comparison
equal
deleted
inserted
replaced
15635:c51d2a06f5f9 | 15636:6f1c7e9a6393 |
---|---|
1727 #endif | 1727 #endif |
1728 | 1728 |
1729 /* Cursor on first line by default. */ | 1729 /* Cursor on first line by default. */ |
1730 curwin->w_cursor.lnum = 1; | 1730 curwin->w_cursor.lnum = 1; |
1731 curwin->w_cursor.col = 0; | 1731 curwin->w_cursor.col = 0; |
1732 #ifdef FEAT_VIRTUALEDIT | |
1733 curwin->w_cursor.coladd = 0; | 1732 curwin->w_cursor.coladd = 0; |
1734 #endif | |
1735 curwin->w_set_curswant = TRUE; | 1733 curwin->w_set_curswant = TRUE; |
1736 curwin->w_topline_was_set = FALSE; | 1734 curwin->w_topline_was_set = FALSE; |
1737 | 1735 |
1738 /* mark cursor position as being invalid */ | 1736 /* mark cursor position as being invalid */ |
1739 curwin->w_valid = 0; | 1737 curwin->w_valid = 0; |
2331 /* cursor is at to BOL and w_cursor.lnum is checked due to getfile() */ | 2329 /* cursor is at to BOL and w_cursor.lnum is checked due to getfile() */ |
2332 if (!p_sol && col != 0) | 2330 if (!p_sol && col != 0) |
2333 { | 2331 { |
2334 curwin->w_cursor.col = col; | 2332 curwin->w_cursor.col = col; |
2335 check_cursor_col(); | 2333 check_cursor_col(); |
2336 #ifdef FEAT_VIRTUALEDIT | |
2337 curwin->w_cursor.coladd = 0; | 2334 curwin->w_cursor.coladd = 0; |
2338 #endif | |
2339 curwin->w_set_curswant = TRUE; | 2335 curwin->w_set_curswant = TRUE; |
2340 } | 2336 } |
2341 return OK; | 2337 return OK; |
2342 } | 2338 } |
2343 --RedrawingDisabled; | 2339 --RedrawingDisabled; |
2361 curwin->w_cursor.col = 0; | 2357 curwin->w_cursor.col = 0; |
2362 else | 2358 else |
2363 { | 2359 { |
2364 curwin->w_cursor.col = fpos->col; | 2360 curwin->w_cursor.col = fpos->col; |
2365 check_cursor_col(); | 2361 check_cursor_col(); |
2366 #ifdef FEAT_VIRTUALEDIT | |
2367 curwin->w_cursor.coladd = 0; | 2362 curwin->w_cursor.coladd = 0; |
2368 #endif | |
2369 curwin->w_set_curswant = TRUE; | 2363 curwin->w_set_curswant = TRUE; |
2370 } | 2364 } |
2371 } | 2365 } |
2372 | 2366 |
2373 #if defined(FEAT_QUICKFIX) || defined(FEAT_EVAL) || defined(PROTO) | 2367 #if defined(FEAT_QUICKFIX) || defined(FEAT_EVAL) || defined(PROTO) |
2956 */ | 2950 */ |
2957 pos_T * | 2951 pos_T * |
2958 buflist_findfpos(buf_T *buf) | 2952 buflist_findfpos(buf_T *buf) |
2959 { | 2953 { |
2960 wininfo_T *wip; | 2954 wininfo_T *wip; |
2961 static pos_T no_position = INIT_POS_T(1, 0, 0); | 2955 static pos_T no_position = {1, 0, 0}; |
2962 | 2956 |
2963 wip = find_wininfo(buf, FALSE); | 2957 wip = find_wininfo(buf, FALSE); |
2964 if (wip != NULL) | 2958 if (wip != NULL) |
2965 return &(wip->wi_fpos); | 2959 return &(wip->wi_fpos); |
2966 else | 2960 else |
3953 if (wp->w_cursor.col > (colnr_T)len) | 3947 if (wp->w_cursor.col > (colnr_T)len) |
3954 { | 3948 { |
3955 // Line may have changed since checking the cursor column, or the lnum | 3949 // Line may have changed since checking the cursor column, or the lnum |
3956 // was adjusted above. | 3950 // was adjusted above. |
3957 wp->w_cursor.col = (colnr_T)len; | 3951 wp->w_cursor.col = (colnr_T)len; |
3958 #ifdef FEAT_VIRTUALEDIT | |
3959 wp->w_cursor.coladd = 0; | 3952 wp->w_cursor.coladd = 0; |
3960 #endif | |
3961 byteval = 0; | 3953 byteval = 0; |
3962 } | 3954 } |
3963 else | 3955 else |
3964 byteval = (*mb_ptr2char)(p + wp->w_cursor.col); | 3956 byteval = (*mb_ptr2char)(p + wp->w_cursor.col); |
3965 | 3957 |