Mercurial > vim
comparison src/diff.c @ 17986:5c8906f653f5 v8.1.1989
patch 8.1.1989: the evalfunc.c file is still too big
Commit: https://github.com/vim/vim/commit/af7645d3733fdd3cd2df03ec7b653601d26969ef
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Sep 5 22:33:28 2019 +0200
patch 8.1.1989: the evalfunc.c file is still too big
Problem: The evalfunc.c file is still too big.
Solution: Move f_pathshorten() to filepath.c. Move f_cscope_connection() to
if_cscope.c. Move diff_ functions to diff.c. Move timer_
functions to ex_cmds2.c. move callback functions to evalvars.c.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 05 Sep 2019 22:45:04 +0200 |
parents | ba63a184e6b6 |
children | c8a53c0daeed |
comparison
equal
deleted
inserted
replaced
17985:9b43688b26bf | 17986:5c8906f653f5 |
---|---|
3213 return -1; | 3213 return -1; |
3214 ((char_u **)dout->dout_ga.ga_data)[dout->dout_ga.ga_len++] = p; | 3214 ((char_u **)dout->dout_ga.ga_data)[dout->dout_ga.ga_len++] = p; |
3215 return 0; | 3215 return 0; |
3216 } | 3216 } |
3217 | 3217 |
3218 #endif /* FEAT_DIFF */ | 3218 #endif // FEAT_DIFF |
3219 | |
3220 #if defined(FEAT_EVAL) || defined(PROTO) | |
3221 | |
3222 /* | |
3223 * "diff_filler()" function | |
3224 */ | |
3225 void | |
3226 f_diff_filler(typval_T *argvars UNUSED, typval_T *rettv UNUSED) | |
3227 { | |
3228 #ifdef FEAT_DIFF | |
3229 rettv->vval.v_number = diff_check_fill(curwin, tv_get_lnum(argvars)); | |
3230 #endif | |
3231 } | |
3232 | |
3233 /* | |
3234 * "diff_hlID()" function | |
3235 */ | |
3236 void | |
3237 f_diff_hlID(typval_T *argvars UNUSED, typval_T *rettv UNUSED) | |
3238 { | |
3239 #ifdef FEAT_DIFF | |
3240 linenr_T lnum = tv_get_lnum(argvars); | |
3241 static linenr_T prev_lnum = 0; | |
3242 static varnumber_T changedtick = 0; | |
3243 static int fnum = 0; | |
3244 static int change_start = 0; | |
3245 static int change_end = 0; | |
3246 static hlf_T hlID = (hlf_T)0; | |
3247 int filler_lines; | |
3248 int col; | |
3249 | |
3250 if (lnum < 0) /* ignore type error in {lnum} arg */ | |
3251 lnum = 0; | |
3252 if (lnum != prev_lnum | |
3253 || changedtick != CHANGEDTICK(curbuf) | |
3254 || fnum != curbuf->b_fnum) | |
3255 { | |
3256 /* New line, buffer, change: need to get the values. */ | |
3257 filler_lines = diff_check(curwin, lnum); | |
3258 if (filler_lines < 0) | |
3259 { | |
3260 if (filler_lines == -1) | |
3261 { | |
3262 change_start = MAXCOL; | |
3263 change_end = -1; | |
3264 if (diff_find_change(curwin, lnum, &change_start, &change_end)) | |
3265 hlID = HLF_ADD; /* added line */ | |
3266 else | |
3267 hlID = HLF_CHD; /* changed line */ | |
3268 } | |
3269 else | |
3270 hlID = HLF_ADD; /* added line */ | |
3271 } | |
3272 else | |
3273 hlID = (hlf_T)0; | |
3274 prev_lnum = lnum; | |
3275 changedtick = CHANGEDTICK(curbuf); | |
3276 fnum = curbuf->b_fnum; | |
3277 } | |
3278 | |
3279 if (hlID == HLF_CHD || hlID == HLF_TXD) | |
3280 { | |
3281 col = tv_get_number(&argvars[1]) - 1; /* ignore type error in {col} */ | |
3282 if (col >= change_start && col <= change_end) | |
3283 hlID = HLF_TXD; /* changed text */ | |
3284 else | |
3285 hlID = HLF_CHD; /* changed line */ | |
3286 } | |
3287 rettv->vval.v_number = hlID == (hlf_T)0 ? 0 : (int)hlID; | |
3288 #endif | |
3289 } | |
3290 | |
3291 #endif |