Mercurial > vim
diff src/list.c @ 19203:09f01421a356 v8.2.0160
patch 8.2.0160: range test fails
Commit: https://github.com/vim/vim/commit/89bfc8218c1b3f41cc5d0fe06afd7d0fb2bd5dc6
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jan 27 22:37:23 2020 +0100
patch 8.2.0160: range test fails
Problem: Range test fails.
Solution: Include change in list code. (https://github.com/vim/vim/issues/5541)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 27 Jan 2020 22:45:04 +0100 |
parents | 94eda51ba9ba |
children | d776967d0f0d |
line wrap: on
line diff
--- a/src/list.c +++ b/src/list.c @@ -1992,6 +1992,7 @@ f_count(typval_T *argvars, typval_T *ret if ((l = argvars[0].vval.v_list) != NULL) { + range_list_materialize(l); li = l->lv_first; if (argvars[2].v_type != VAR_UNKNOWN) { @@ -2256,6 +2257,16 @@ f_reverse(typval_T *argvars, typval_T *r && !var_check_lock(l->lv_lock, (char_u *)N_("reverse() argument"), TRUE)) { + if (l->lv_first == &range_list_item) + { + varnumber_T new_start = l->lv_start + + (l->lv_len - 1) * l->lv_stride; + l->lv_end = new_start - (l->lv_end - l->lv_start); + l->lv_start = new_start; + l->lv_stride = -l->lv_stride; + rettv_list_set(rettv, l); + return; + } li = l->lv_last; l->lv_first = l->lv_last = NULL; l->lv_len = 0;