Mercurial > vim
changeset 2772:18ad854f5dcd v7.3.162
updated for version 7.3.162
Problem: No error message when assigning to a list with an index out of
range. (Yukihiro Nakadaira)
Solution: Add the error message.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Thu, 21 Apr 2011 14:27:28 +0200 |
parents | 987cd9455925 |
children | df01e20e6be2 |
files | src/eval.c src/version.c |
diffstat | 2 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/eval.c +++ b/src/eval.c @@ -2794,6 +2794,8 @@ get_lval(name, rettv, lp, unlet, skip, q { if (lp->ll_range && !lp->ll_empty2) clear_tv(&var2); + if (!quiet) + EMSGN(_(e_listidx), lp->ll_n1); return NULL; } @@ -2811,7 +2813,11 @@ get_lval(name, rettv, lp, unlet, skip, q { ni = list_find(lp->ll_list, lp->ll_n2); if (ni == NULL) + { + if (!quiet) + EMSGN(_(e_listidx), lp->ll_n2); return NULL; + } lp->ll_n2 = list_idx_of_item(lp->ll_list, ni); } @@ -2819,7 +2825,11 @@ get_lval(name, rettv, lp, unlet, skip, q if (lp->ll_n1 < 0) lp->ll_n1 = list_idx_of_item(lp->ll_list, lp->ll_li); if (lp->ll_n2 < lp->ll_n1) + { + if (!quiet) + EMSGN(_(e_listidx), lp->ll_n2); return NULL; + } } lp->ll_tv = &lp->ll_li->li_tv;