Mercurial > vim
comparison src/ex_cmds2.c @ 7647:65b2d593c203 v7.4.1123
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 17 19:39:00 2016 +0100
patch 7.4.1123
Problem: Using ":argadd" when there are no arguments results in the second
argument to be the current one. (Yegappan Lakshmanan)
Solution: Correct the w_arg_idx value.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 17 Jan 2016 19:45:04 +0100 |
parents | 0ecb62a66a7a |
children | f6311c321411 |
comparison
equal
deleted
inserted
replaced
7646:a9a6001dc181 | 7647:65b2d593c203 |
---|---|
2834 int count; | 2834 int count; |
2835 char_u **files; | 2835 char_u **files; |
2836 int after; /* where to add: 0 = before first one */ | 2836 int after; /* where to add: 0 = before first one */ |
2837 { | 2837 { |
2838 int i; | 2838 int i; |
2839 int old_argcount = ARGCOUNT; | |
2839 | 2840 |
2840 if (ga_grow(&ALIST(curwin)->al_ga, count) == OK) | 2841 if (ga_grow(&ALIST(curwin)->al_ga, count) == OK) |
2841 { | 2842 { |
2842 if (after < 0) | 2843 if (after < 0) |
2843 after = 0; | 2844 after = 0; |
2850 { | 2851 { |
2851 ARGLIST[after + i].ae_fname = files[i]; | 2852 ARGLIST[after + i].ae_fname = files[i]; |
2852 ARGLIST[after + i].ae_fnum = buflist_add(files[i], BLN_LISTED); | 2853 ARGLIST[after + i].ae_fnum = buflist_add(files[i], BLN_LISTED); |
2853 } | 2854 } |
2854 ALIST(curwin)->al_ga.ga_len += count; | 2855 ALIST(curwin)->al_ga.ga_len += count; |
2855 if (curwin->w_arg_idx >= after) | 2856 if (old_argcount > 0 && curwin->w_arg_idx >= after) |
2856 ++curwin->w_arg_idx; | 2857 curwin->w_arg_idx += count; |
2857 return after; | 2858 return after; |
2858 } | 2859 } |
2859 | 2860 |
2860 for (i = 0; i < count; ++i) | 2861 for (i = 0; i < count; ++i) |
2861 vim_free(files[i]); | 2862 vim_free(files[i]); |