Mercurial > vim
comparison src/mbyte.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 | 7fad90423bd2 |
comparison
equal
deleted
inserted
replaced
15635:c51d2a06f5f9 | 15636:6f1c7e9a6393 |
---|---|
3992 * possibly a utf-8 file with illegal bytes. Setup for conversion | 3992 * possibly a utf-8 file with illegal bytes. Setup for conversion |
3993 * from utf-8 to 'fileencoding'. */ | 3993 * from utf-8 to 'fileencoding'. */ |
3994 convert_setup(&vimconv, p_enc, curbuf->b_p_fenc); | 3994 convert_setup(&vimconv, p_enc, curbuf->b_p_fenc); |
3995 } | 3995 } |
3996 | 3996 |
3997 #ifdef FEAT_VIRTUALEDIT | |
3998 curwin->w_cursor.coladd = 0; | 3997 curwin->w_cursor.coladd = 0; |
3999 #endif | |
4000 for (;;) | 3998 for (;;) |
4001 { | 3999 { |
4002 p = ml_get_cursor(); | 4000 p = ml_get_cursor(); |
4003 if (vimconv.vc_type != CONV_NONE) | 4001 if (vimconv.vc_type != CONV_NONE) |
4004 { | 4002 { |
4116 void | 4114 void |
4117 mb_adjustpos(buf_T *buf, pos_T *lp) | 4115 mb_adjustpos(buf_T *buf, pos_T *lp) |
4118 { | 4116 { |
4119 char_u *p; | 4117 char_u *p; |
4120 | 4118 |
4121 if (lp->col > 0 | 4119 if (lp->col > 0 || lp->coladd > 1) |
4122 #ifdef FEAT_VIRTUALEDIT | |
4123 || lp->coladd > 1 | |
4124 #endif | |
4125 ) | |
4126 { | 4120 { |
4127 p = ml_get_buf(buf, lp->lnum, FALSE); | 4121 p = ml_get_buf(buf, lp->lnum, FALSE); |
4128 if (*p == NUL || (int)STRLEN(p) < lp->col) | 4122 if (*p == NUL || (int)STRLEN(p) < lp->col) |
4129 lp->col = 0; | 4123 lp->col = 0; |
4130 else | 4124 else |
4131 lp->col -= (*mb_head_off)(p, p + lp->col); | 4125 lp->col -= (*mb_head_off)(p, p + lp->col); |
4132 #ifdef FEAT_VIRTUALEDIT | |
4133 /* Reset "coladd" when the cursor would be on the right half of a | 4126 /* Reset "coladd" when the cursor would be on the right half of a |
4134 * double-wide character. */ | 4127 * double-wide character. */ |
4135 if (lp->coladd == 1 | 4128 if (lp->coladd == 1 |
4136 && p[lp->col] != TAB | 4129 && p[lp->col] != TAB |
4137 && vim_isprintc((*mb_ptr2char)(p + lp->col)) | 4130 && vim_isprintc((*mb_ptr2char)(p + lp->col)) |
4138 && ptr2cells(p + lp->col) > 1) | 4131 && ptr2cells(p + lp->col) > 1) |
4139 lp->coladd = 0; | 4132 lp->coladd = 0; |
4140 #endif | |
4141 } | 4133 } |
4142 } | 4134 } |
4143 | 4135 |
4144 /* | 4136 /* |
4145 * Return a pointer to the character before "*p", if there is one. | 4137 * Return a pointer to the character before "*p", if there is one. |