diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-02-17 16:31:35 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-02-17 16:31:35 +0100 |
commit | 79518e2ace5fce7b9c49060e462a6e935dba0a84 (patch) | |
tree | 5a5b1284386ac2aff2f39f50238327a54b46a7c3 /src/evalfunc.c | |
parent | 226c53429109f24e31c17016aedfd7fbf7a9aa50 (diff) | |
download | vim-79518e2ace5fce7b9c49060e462a6e935dba0a84.zip |
patch 8.0.0334: can't access b:changedtick from a dict reference
Problem: Can't access b:changedtick from a dict reference.
Solution: Make changedtick a member of the b: dict. (inspired by neovim
#6112)
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r-- | src/evalfunc.c | 41 |
1 files changed, 15 insertions, 26 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c index 5671cf061..55900bd9a 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -2539,7 +2539,7 @@ f_diff_hlID(typval_T *argvars UNUSED, typval_T *rettv UNUSED) #ifdef FEAT_DIFF linenr_T lnum = get_tv_lnum(argvars); static linenr_T prev_lnum = 0; - static int changedtick = 0; + static varnumber_T changedtick = 0; static int fnum = 0; static int change_start = 0; static int change_end = 0; @@ -2550,7 +2550,7 @@ f_diff_hlID(typval_T *argvars UNUSED, typval_T *rettv UNUSED) if (lnum < 0) /* ignore type error in {lnum} arg */ lnum = 0; if (lnum != prev_lnum - || changedtick != curbuf->b_changedtick + || changedtick != *curbuf->b_changedtick || fnum != curbuf->b_fnum) { /* New line, buffer, change: need to get the values. */ @@ -2572,7 +2572,7 @@ f_diff_hlID(typval_T *argvars UNUSED, typval_T *rettv UNUSED) else hlID = (hlf_T)0; prev_lnum = lnum; - changedtick = curbuf->b_changedtick; + changedtick = *curbuf->b_changedtick; fnum = curbuf->b_fnum; } @@ -3957,7 +3957,7 @@ get_buffer_info(buf_T *buf) dict_add_nr_str(dict, "loaded", buf->b_ml.ml_mfp != NULL, NULL); dict_add_nr_str(dict, "listed", buf->b_p_bl, NULL); dict_add_nr_str(dict, "changed", bufIsChanged(buf), NULL); - dict_add_nr_str(dict, "changedtick", buf->b_changedtick, NULL); + dict_add_nr_str(dict, "changedtick", *buf->b_changedtick, NULL); dict_add_nr_str(dict, "hidden", buf->b_ml.ml_mfp != NULL && buf->b_nwindows == 0, NULL); @@ -4190,12 +4190,6 @@ f_getbufvar(typval_T *argvars, typval_T *rettv) /* buffer-local-option */ done = TRUE; } - else if (STRCMP(varname, "changedtick") == 0) - { - rettv->v_type = VAR_NUMBER; - rettv->vval.v_number = curbuf->b_changedtick; - done = TRUE; - } else { /* Look up the variable. */ @@ -6576,21 +6570,16 @@ f_islocked(typval_T *argvars, typval_T *rettv) { if (lv.ll_tv == NULL) { - if (check_changedtick(lv.ll_name)) - rettv->vval.v_number = 1; /* always locked */ - else + di = find_var(lv.ll_name, NULL, TRUE); + if (di != NULL) { - di = find_var(lv.ll_name, NULL, TRUE); - if (di != NULL) - { - /* Consider a variable locked when: - * 1. the variable itself is locked - * 2. the value of the variable is locked. - * 3. the List or Dict value is locked. - */ - rettv->vval.v_number = ((di->di_flags & DI_FLAGS_LOCK) - || tv_islocked(&di->di_tv)); - } + /* Consider a variable locked when: + * 1. the variable itself is locked + * 2. the value of the variable is locked. + * 3. the List or Dict value is locked. + */ + rettv->vval.v_number = ((di->di_flags & DI_FLAGS_LOCK) + || tv_islocked(&di->di_tv)); } } else if (lv.ll_range) @@ -11551,8 +11540,8 @@ f_submatch(typval_T *argvars, typval_T *rettv) return; if (no < 0 || no >= NSUBEXP) { - EMSGN(_("E935: invalid submatch number: %d"), no); - return; + EMSGN(_("E935: invalid submatch number: %d"), no); + return; } if (argvars[1].v_type != VAR_UNKNOWN) retList = (int)get_tv_number_chk(&argvars[1], &error); |