Mercurial > vim
comparison src/misc1.c @ 777:f664cc974a7a
updated for version 7.0227
author | vimboss |
---|---|
date | Fri, 17 Mar 2006 23:19:38 +0000 |
parents | 8ccb9047b14d |
children | 9f345c48220b |
comparison
equal
deleted
inserted
replaced
776:5a5a080c2776 | 777:f664cc974a7a |
---|---|
2145 * | 2145 * |
2146 * return FAIL for failure, OK otherwise | 2146 * return FAIL for failure, OK otherwise |
2147 */ | 2147 */ |
2148 /*ARGSUSED*/ | 2148 /*ARGSUSED*/ |
2149 int | 2149 int |
2150 del_bytes(count, fixpos, use_delcombine) | 2150 del_bytes(count, fixpos_arg, use_delcombine) |
2151 long count; | 2151 long count; |
2152 int fixpos; | 2152 int fixpos_arg; |
2153 int use_delcombine; /* 'delcombine' option applies */ | 2153 int use_delcombine; /* 'delcombine' option applies */ |
2154 { | 2154 { |
2155 char_u *oldp, *newp; | 2155 char_u *oldp, *newp; |
2156 colnr_T oldlen; | 2156 colnr_T oldlen; |
2157 linenr_T lnum = curwin->w_cursor.lnum; | 2157 linenr_T lnum = curwin->w_cursor.lnum; |
2158 colnr_T col = curwin->w_cursor.col; | 2158 colnr_T col = curwin->w_cursor.col; |
2159 int was_alloced; | 2159 int was_alloced; |
2160 long movelen; | 2160 long movelen; |
2161 int fixpos = fixpos_arg; | |
2161 | 2162 |
2162 oldp = ml_get(lnum); | 2163 oldp = ml_get(lnum); |
2163 oldlen = (int)STRLEN(oldp); | 2164 oldlen = (int)STRLEN(oldp); |
2164 | 2165 |
2165 /* | 2166 /* |
2199 movelen = (long)oldlen - (long)col - count + 1; /* includes trailing NUL */ | 2200 movelen = (long)oldlen - (long)col - count + 1; /* includes trailing NUL */ |
2200 if (movelen <= 1) | 2201 if (movelen <= 1) |
2201 { | 2202 { |
2202 /* | 2203 /* |
2203 * If we just took off the last character of a non-blank line, and | 2204 * If we just took off the last character of a non-blank line, and |
2204 * fixpos is TRUE, we don't want to end up positioned at the NUL. | 2205 * fixpos is TRUE, we don't want to end up positioned at the NUL, |
2206 * unless "restart_edit" is set or 'virtualedit' contains "onemore". | |
2205 */ | 2207 */ |
2206 if (col > 0 && fixpos) | 2208 if (col > 0 && fixpos && restart_edit == 0 |
2209 #ifdef FEAT_VIRTUALEDIT | |
2210 && (ve_flags & VE_ONEMORE) == 0 | |
2211 #endif | |
2212 ) | |
2207 { | 2213 { |
2208 --curwin->w_cursor.col; | 2214 --curwin->w_cursor.col; |
2209 #ifdef FEAT_VIRTUALEDIT | 2215 #ifdef FEAT_VIRTUALEDIT |
2210 curwin->w_cursor.coladd = 0; | 2216 curwin->w_cursor.coladd = 0; |
2211 #endif | 2217 #endif |